12-23-2015 05:47 PM
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?
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?
12-23-2015 06:03 PM
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.