BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ateffal
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.

View solution in original post

4 REPLIES 4
ateffal
Calcite | Level 5

Thnks for your reply but unfortunately this is not the case. There is as many numerics as characters.

Kurt_Bremser
Super User

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.

Tom
Super User Tom
Super User

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.

 

 

 

 

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 926 views
  • 1 like
  • 3 in conversation