hi,
Problem-I:
suppose I have following variables: v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,v14,v15,v16,v17,v18,v19,v20,v21,v22,v23,v24, v25,v26 and so on
Is it possible to rename those variables which will take following respective names:
6.98,7.98,8.98,9.98,10.98,11.98,12.98,1.99,2.99,3.99,4.99,5.99,6.99,7.99,8.99,9.99,10.99,11.99,12.99,1.00,2.00,3.00,4.00,5.00,6.00,7.00,8.00,9.00,10.00,11.00,12.00......and so on.
the number before the dot is month, and the number after the dot is year. I want to do this for a large number of variables, so I don't want code with fixed number of years, rather it would be with variable year. Can you write a code for this?
Problem-I:
Suppose I have data, now I want to delete the cases whose ages are greater than 25 born in Australia, if the variable for age is A and Country of birth is C, can u also write a code for this?
Fist, you cannot expect anyone else to write the code for you, especially when you haven't even tried yourself.
So, you can't rename variables in that manner, they don't comply with SAS naming standards (or any other database that I know of).
My suggestion is that you transpose your data set to make the variables classifier values instead - then you can rename them almost any way you want. Take a look at PROC TRANSPOSE, or the data step with explicit output.
Your second problem looks like a normal WHERE statement with a combination of conditions, should be no problem for your to write it.
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.