BookmarkSubscribeRSS Feed
milts
Pyrite | Level 9
hi

is there a way to determine the current column being read by sas and the stop reading the current record and go to the next one?

let's say main table contains 10 columns. i want to read only columns 1-5.

and what if i want to read columns 1-5,then 6-10?

data x;
set main;
.
.
run;

thanks a bunch!
3 REPLIES 3
Peter_C
Rhodochrosite | Level 12
yes.
but with so many possibilities and so little information about your data I thìnk the best advice for you would be to read up on infile options COLUMN, LRECL and a lot of examples of the INPUT statement.
It is one of the richest parts of the SAS language functionality. imho

PeterC
ChrisNZ
Tourmaline | Level 20
You have a set statement there, not an infile statement.

If this is what you mean, sas reads all columns at once. Read the about the program data vector in the online doc.
deleted_user
Not applicable
Hi,

To control observations we can use _N_ which stores the observation number which sas is processing. you can subset your dataset by writing conditions on _N_.

and there are two direct options FIRSTOBS,OBS

if you set FIRSTOBS option to 6 and OBS to 10
sas starts reading from 6th observation to 10 th observation

Hope this will help you,

Regards,
skm

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 857 views
  • 0 likes
  • 4 in conversation