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

I have a dataset which initially has more than 8000 rows.

 

Then when I execute the following SAS code:

 

rsubmit;
data have2;
set initial_dataset;
/* Since beginning is always equal to 1, I don't use it here in my code */
if /* beginning=1 and */ end=2 then flag=1;
else flag=0;
run;
endrsubmit;

 

the resulting dataset (have2) only has 10 rows. Why is this the case and how can I fix it?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

This could happen if this statement appears anywhere within your code:

 

options obs=10;

Much less likely, this would cause similar trouble:

 

options firstobs=7991;

Other than that, we are left with the possibility of investigating the data further to find out if the incoming data set really contains 8000 observations.

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Can you post the log please? There is nothing in your code that subsets the number of observations.

Astounding
PROC Star

This could happen if this statement appears anywhere within your code:

 

options obs=10;

Much less likely, this would cause similar trouble:

 

options firstobs=7991;

Other than that, we are left with the possibility of investigating the data further to find out if the incoming data set really contains 8000 observations.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 369 views
  • 0 likes
  • 3 in conversation