03-21-2017 12:30 AM - edited 03-21-2017 12:31 AM
I have been struggling with this problem for a few days, and I haven't found something that quite works the way I want it to work. I'm sure someone with a bit more experiance will know exactlly how to do it! Thank you for the help! Here goes!
I have 2 data sets, one has test name and a test name ID.
The other is from a proc mean procedure and has student ID numbers, the average, and then every cell has the average score for that student in that test. The variable names have test_1, test_2, ect... and these correspond to the test name ID in the name data set. The variable names in the proc mean data set are not in ordet, so I can't simpily assign it. I need to sort these values somehow, but the variable names are character type.
I am trying to find a way to assign the names (from the name data set) to the variable names (in the proc mean data set).
The other thing is that I would want to keep as much of the name as possible, some names have (), or # and % signs, and I want to keep those so that we can understand how the test was measured.
In my sample data there are 12 test, and I could simpily rename all the variables, but the ture data set has 300 test and like 10000 students.
I welcome any suggestions!
Thank you again!
03-27-2017 05:10 PM
Have you considered not renaming all the variables, but just applying labels that carry the vital information?
It really depends on what you need to do with these data, but labels might be as or more useful than variable names.
03-27-2017 06:55 PM
I agree with @collinelliot. Labels would be a lot easier. Try the following:
proc sql noprint; select catt('label test_',test_id,'="',test_name,'";') into :labels separated by ' ' from name_table ; quit; data want; set mean_table; &labels.; run;
and then simply show the labels rather than the variable names.
Art, CEO, AnalystFinder.com