The method of renaming variables has already been shown by @ed_sas_member in Message #4 in this thread.
As stated above, if you are getting character variables as a result, then something else is wrong, most likely the variables are already character variables. Please show us a PROC CONTENTS output of this data set.
If somehow PROC CONTENTS shows these variables as numeric then we need to see the EXACT code you are using to rename, and a PROC CONTENTS on the output data set.
--Pleas provide some sample data Thank you
Obsidian | Level 7like in the following dataset I want to replace variables cohort_11, cohort_12 and cohort_13 with numeric variable names c11,c12 and c13 respectively. how to do it?
Meteorite | Level 14data want; set have; rename cohort_11 = c11 cohort_12 = c12 cohort_13 = c13; run;
Obsidian | Level 7
yeah but by this method, I am getting character variables, but I want SAS to read the new variables as numeric variables, so how to do this?
Super User@TANMOY05 wrote:yeah but by this method, I am getting character variables, but I want SAS to read the new variables as numeric variables, so how to do this?
If the "renamed" variables are character then your original variables are character. You would have to use an input statement for each variable.
The picture of the data you show makes be strongly suspect that it is the result of Proc Transpose. If that is the case then likely the best approach would be to create a SINGLE numeric variable from what ever value was transposed with something like:
set have; /* the set BEFORE transpose*/
Then transpose the data with the NUMVAL instead of your character value.