data Examplex;
input Name $ 9-19 Designee $ 20-32 Department $;
datalines;
Madhu Jr_Associate QA
Sathwik Jr_Associate PB
Mohan Manager PB
Raja Manager QA
Kiran Manager BR
Sainath Manager CL
;
run;
proc print data = Examplex;
run;
I had table which is given in Photo and Program. By using this table i want create new table by taking two observations in that given table.
Which is it?
"some random two observations"
or
"When i need particular 2 and 5 observations"?
If you know the two observations then you where clause it for that:
data want; set have; if _n_ in (2,5); run; proc print data=want; run;
For positional, or you could change the where to be the values from those rows.
Do stop putting datalines indented. SAS reads data from position 1.
For this "By using this table i want create new table by taking two observations in that given table. " - you will need to clarify, do you want the first two observations, some random two?
proc surveyselect data=Examplex out=want noprint
seed=1234 method=srs
sampsize=2;
run;
Which is it?
"some random two observations"
or
"When i need particular 2 and 5 observations"?
If you know the two observations then you where clause it for that:
data want; set have; if _n_ in (2,5); run; proc print data=want; run;
For positional, or you could change the where to be the values from those rows.
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!
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.