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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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