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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.