Help using Base SAS procedures

Creating a sub-dataset with select data entries

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

Creating a sub-dataset with select data entries

Hi All,

I want to create a sub-dataset 'have' where the 'personalID' are only 'Q1111' , 'Q1114', 'Q1117', 'Q1123', 'Q1127', 'Q1129' from the following dataset 'Want'.

I tried different codes but did not succeed. Any help is highly appreciated. Thanks in advance.

personalID      VariableA     VariableB

Q1111              131.32            56.43

Q1112              132.21            65.34

Q1113              167.23            70.23

Q1114              145.34            56.34

Q1115              135.12            98.56

Q1116              145.56            99.42

Q1117              123.45            76.33

Q1118              167.43            87.34

Q1119              189.12            98.32

Q1120              145.23            93.23

Q1121              129.23            93.23

Q1122              167.34            98.32

Q1123              187.23            76.34

Q1124              179.23            88.65

Q1125              175.34            45.24

Q1126              136.23            54.23

Q1127              181.23            59.56

Q1128              173.43            60.34

Q1129              190.23            91.23

Q1130              191.12            93.21


Accepted Solutions
Solution
‎12-29-2014 02:33 PM
Super User
Posts: 17,784

Re: Creating a sub-dataset with select data entries

Data have;

set want;

where PersonalID In ( 'Q1111'  'Q1114'  'Q1117'   'Q1123'  'Q1127'  Q1129');

run;

View solution in original post


All Replies
Super User
Posts: 17,784

Re: Creating a sub-dataset with select data entries

What did you try?

Contributor
Posts: 32

Re: Creating a sub-dataset with select data entries

Thank you. I tried this but did not work. What did I do incorrect?

Data have;

set want;

where 'PersonalID'= 'Q1111'  'Q1114'  'Q1117'   'Q1123'  'Q1127'  Q1129';

run;

Solution
‎12-29-2014 02:33 PM
Super User
Posts: 17,784

Re: Creating a sub-dataset with select data entries

Data have;

set want;

where PersonalID In ( 'Q1111'  'Q1114'  'Q1117'   'Q1123'  'Q1127'  Q1129');

run;

Contributor
Posts: 32

Re: Creating a sub-dataset with select data entries

Thank you much!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 191 views
  • 0 likes
  • 2 in conversation