Given the SAS data set WORK.INPUT:
Var1 Var2
------ -------
A one
A two
B three
C four
A five
The following SAS program is submitted:
data WORK.ONE WORK.TWO;
set WORK.INPUT;
if Var1='A' then output WORK.ONE;
output;
run;
How many observations will be in data set WORK.ONE?
I do not understand why the observation is 8. I only got 3 observations when Var1 is A.
@anming wrote:
Given the SAS data set WORK.INPUT:
Var1 Var2
------ -------
A one
A two
B three
C four
A five
The following SAS program is submitted:
data WORK.ONE WORK.TWO;
set WORK.INPUT;
if Var1='A' then output WORK.ONE;
output;
run;
How many observations will be in data set WORK.ONE?I do not understand why the observation is 8. I only got 3 observations when Var1 is A.
Let's see here: one line tests to see if VAR1='A' and then outputs three records to WORK.ONE. The next line outputs all records to WORK.ONE. That's 8
@anming wrote:
Given the SAS data set WORK.INPUT:
Var1 Var2
------ -------
A one
A two
B three
C four
A five
The following SAS program is submitted:
data WORK.ONE WORK.TWO;
set WORK.INPUT;
if Var1='A' then output WORK.ONE;
output;
run;
How many observations will be in data set WORK.ONE?I do not understand why the observation is 8. I only got 3 observations when Var1 is A.
Let's see here: one line tests to see if VAR1='A' and then outputs three records to WORK.ONE. The next line outputs all records to WORK.ONE. That's 8
data test;
input var1$ var2$;
datalines;
A one
A Two
B Three
C four
A five
;
run;
data work.one work.two;
set test;
if var1='A' then output work.one;
output;
run;
these are test codes.
work.one has 8 observions while work.two has 5 observions. Wonderful!
This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:
Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers
Ready to level-up your skills? Choose your own adventure.