×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

calling a macro from a data step

calling a macro from a data step

calling a macro from a data step

(OP)
I'm trying to create a field in a datasets based in the value of another field.
I'm usind a macro to make se assignment of the value. Yo can see the process bellow.
The real macro is not that simplem but I'ms using it to make tests.

I expect that result:

campo1 campo2
ab 1
ac 2

but I get:

campo1 campo2
ab 1
ac 2

I'm not sure if I have any error in the method of calling a macro from a data sets

Can anybodt hepl me???, any advice would n greatly apreciatted.

----

data prueba;
length campo1 $10.;
campo1 = 'ab';
output;
campo1 = 'ac';
output;
run;

data prueba1;
set prueba;
campo2 = %valor1(campo1);
run;


%macro valor1(campo);
%if %trim(&campo) = 'ab' %then %do;
%let salida = 1;
%end;
%else %do;
%let salida = 2;
%end;
&salida;
%mend;

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close