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

I have the following code but want to limit the result to 10 instead of all the data. I thought firstobs=10 will make it happen but it did not. Please help!

 

DATA two;
infile 'C:\Users\paul\Downloads\btt.dat' firstobs=10;
input Childid 1-4 Sex 6 Bweight 8-11 Gestage 13-14 Momage 16-17
Parity 19 Mdbp 25-27 Momeduc 29 Mmedaid 31 socio 33 dbp5 35-37 sbp5 39-41
ht5 43-47 wt5 49-52 hdl5 54-57 ldl5 59-62 trig5 64-67 smoke5 69 medaid5 71
socio5 73;
BMI = ht5 / wt5**2;
run;
proc print data=two;
var Childid ht5 wt5 BMI;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Which are you trying to limit:

 

  • The number of observations in TWO
  • The number of observations printed by PROC PRINT

To limit the latter, use:

 

proc print data=two (obs=10);

var Childid ht5 wt5 BMI;
run;

View solution in original post

3 REPLIES 3
Astounding
PROC Star

Which are you trying to limit:

 

  • The number of observations in TWO
  • The number of observations printed by PROC PRINT

To limit the latter, use:

 

proc print data=two (obs=10);

var Childid ht5 wt5 BMI;
run;

pacruz
Calcite | Level 5
The number of observations printed by PROC PRINT
pacruz
Calcite | Level 5
It worked, thank you!

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