Could you please explain me how to modify the code below to use my own list of column names? SAS EG generated the codes below. My column names are currently a jumble of numbers that aren't even in order. I wouldn't have to change their names if I could just put them in order. I'd want to see how this might be resolved.
PROC SORT DATA=WORK.QUERY_FOR_APPEND_TABLE_0000(KEEP="SUM_of_Count(Distinct(AKA_CIN))"n SVC_FROM_DT_MM Age_Group) OUT=WORK.SORTTempTableSorted ; BY DESCENDING Age_Group; RUN; PROC TRANSPOSE DATA=WORK.SORTTempTableSorted OUT=WORK.TRNSTRANSPOSED_0004(LABEL="Transposed WORK.QUERY_FOR_APPEND_TABLE_0000") NAME=Source LABEL=Label ; BY DESCENDING Age_Group; ID SVC_FROM_DT_MM; VAR "SUM_of_Count(Distinct(AKA_CIN))"n;
This is what I am working on:
Thank you.
If you want the variables named using the ID variable to appear in any specific order you might be able to do that by using
PROC SORT DATA=WORK.QUERY_FOR_APPEND_TABLE_0000(KEEP="SUM_of_Count(Distinct(AKA_CIN))"n SVC_FROM_DT_MM Age_Group) OUT=WORK.SORTTempTableSorted ; BY DESCENDING Age_Group Svc_from_dt_mm; RUN;
Maybe. If the ID variable does not have all the same levels for every BY value they will not be created in the order that that they appear in each BY variable group. Since you didn't provide any sort order for the ID variable they are haphazard within the values of the Age_group.
BUT the question is "why bother?" Any output that you create for people to read can specify the order of values and SAS doesn't care about the order of the variables in the data set.
I have to say you are willing to deal with way uglier variable names then I would touch.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.