It doesn't matter if using infile/input, proc sql or a data step. I am interested in selecting a column by it's position and renaming it. I will have a SAS dataset where the column names might change, one is only 2*3, very small but I have to reference it and cannot bet on the variable names being constant going forward. Any way to select the variable names by ordinal position and rename them?
Thanks,
Mark
In a data step you can define an ARRAY and reference the columns by their index. Say you want to work with numeric column number 3.
Or you can rename all the variable using their column index.
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.