There are 200 observations in a dataset, i want to pull out
the observation no's 100, 150,180,190 by using Proc SQL? How
you can get it?
Answers were Sorted based on User's Feedback
Answer / limnesh
Proc Sql;
Select *,monotonic ()as c from <datasetname>
group by a having c in (100,150,180,190);
quit;
Is This Answer Correct ? | 20 Yes | 5 No |
Answer / limnesh dominic
Before saying answer is not correct, please try this
Data f;
do i=1 to 200;
output;
end;
run;
Proc Sql;
Select *,monotonic ()as c from f
group by i having c in (100,150,180,190);
quit;
Proc print;
run;
Is This Answer Correct ? | 15 Yes | 0 No |
Answer / jim
* Setup test data;
data test;
do i=1 to 200;
j=ranuni(i);
output;
end;
run;
Proc Sql;
Select *,monotonic ()as c from test
having c in (100,150,180,190);
quit;
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / pranoy tikadar
PROC SQL;
SELECT*,
MONOTONIC() AS COUNT
FROM TEST
HAVING COUNT IN(100,150,180,190);
QUIT;
Is This Answer Correct ? | 11 Yes | 3 No |
Answer / vipin choudhary
Proc Sql;
Select * from <dataset name>
where _n_ in (100,150,180,190);
quit;
Is This Answer Correct ? | 12 Yes | 29 No |
how to do user inputs and command line arguments in sas?
what is the difference between floor and ceil functions in sas? : Sas-administrator
How would you invoke a macro? : sas-macro
What is the difference between match merge and one to one merge?
what is sas data set?
What is the difference between SAS Data step and SAS PROC SQL, and which is better?
what is Difference between PROC SQL JOINS and MERGE?
I need help in merging two different datasets. I am merging by date and I want to propagate observations from one dataset to the corresponding dates. One dataset has a unique date for each day of the month, while the other dataset has same date for different patient visits. For example I want to spread an observation on the 31DEC2008 from one dataset to several observations with the same date on a second dataset for all the patients who visited on that date. I have tried to merge the two and the result is not what I wanted. Instead I get a dataset whereby all the dates have missing values where observations from the first datset should have spread.
How to read multiple excel sheets from a single excel file at once????
7 Answers HCL, Verinon Technology Solutions,
Give an example where SAS fails to convert character value to numeric value automatically?
How do you control the number of observations and/or variables read or written?
Explain the message 'Merge has one or more datasets with repeats of by variables'.