BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello dears SAS users
my problem is the following
take the dataset sashelp.class;
i just want (i take this example to make you understand my problem)
to assign the following formats
if it's a girl ---> new_name=put (name, $Fname.);
if it's a boy --->new_name= put(name,$Mname.);
i want to retrieve the value of sex for each line in a macro variable (of course depending of the line) and then to put something like this
new_name=put(name,$&&sex&i.name.)
in fact i have in my work to assign a format depending of the country to a numeric value
there is more than 180 differents country so i cannot use the if then else facility
and a good SAS developper says me that the only way to do it is by macro variable facility but in my code, i always put the format of the country of the last line and so, the results are bad
more generally, how can i do to do this ?
may be one idea it to cut my datastep by line but it could be so long, especially when i will have 6 000 000 of lines in my entry dataset...
Should you help me
Thank you very much
1 REPLY 1
data_null__
Jade | Level 19
Look at putC function, with this function format is an character expression.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 852 views
  • 0 likes
  • 2 in conversation