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

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.

 

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
  • 954 views
  • 1 like
  • 3 in conversation