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

I am trying to print observations 131-179 in the data set but keep getting an error message.

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 proc print data=problem4a (firstobs=131 obs=48);
ERROR: FIRSTOBS option > OBS option - no data to read from file WORK.PROBLEM4A.
57 run;
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
 
58
59 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 
the above error is what appears after putting the following code into sas.
 

FILENAME CSV "/folders/myfolders/homeworkdata/diamond.csv" TERMSTR=CRLF;



/** Import the CSV file. **/

PROC IMPORT DATAFILE=CSV
OUT=problem4a
DBMS=CSV
REPLACE;
guessingrows = 1000;
RUN;

/** Print the results. **/

PROC PRINT DATA=problem4a; RUN;

/** Unassign the file reference. **/

FILENAME CSV;

proc print data=problem4a (firstobs=131 obs=48);
run;
 
any help is greatly appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
mohamed_zaki
Barite | Level 11
@MadQuidd wrote:

 

56 proc print data=problem4a (firstobs=131 obs=48);
ERROR: FIRSTOBS option > OBS option - no data to read from file WORK.PROBLEM4A.
 
 

The OBS value specifies the last observation that SAS processes in a data set. 

So in order to do what you want let it be like

proc print data=problem4a (firstobs=131 obs=179);

 

View solution in original post

1 REPLY 1
mohamed_zaki
Barite | Level 11
@MadQuidd wrote:

 

56 proc print data=problem4a (firstobs=131 obs=48);
ERROR: FIRSTOBS option > OBS option - no data to read from file WORK.PROBLEM4A.
 
 

The OBS value specifies the last observation that SAS processes in a data set. 

So in order to do what you want let it be like

proc print data=problem4a (firstobs=131 obs=179);

 

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
  • 1 reply
  • 817 views
  • 0 likes
  • 2 in conversation