Hi,
I want to access specific columns in a SAS table (more than 1000 columns) within a DO loop : for example column number 2 until column before the last one in order to do some specific treatements for each column. How can we do that ?
Thanks
You might give us some clue about the structure of the dataset, regarding order of variables, and which need to be treated.
You still can use two arrays for _numeric_ and _character_, and iterate separately through both.
As long as all the variables you want to treat are of the same type (character or numeric), you can define an array over them and iterate through that.
Thnks for your reply but unfortunately this is not the case. There is as many numerics as characters.
You might give us some clue about the structure of the dataset, regarding order of variables, and which need to be treated.
You still can use two arrays for _numeric_ and _character_, and iterate separately through both.
You cannot easily do that, and in general it would make no sense.
You can define arrays. You can use Variable Lists.
array all_num _numeric_ ;
array all_str _character_;
array some_num firstvar-numeric-lastvar ;
array some_str firstchar-character-lastchar ;
What is the actual PROBLEM that you are trying to solve? Perhaps there is another way to do it that does not requiring treating your dataset as if it was a spreadsheet.
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.