Calcite | Level 5

## Error in Practice Questions provided by SAS?

Hi;

I'm currently preparing to take the Base Programming Certification. I downloaded 4 pages of exercises which I found somewhere on the SAS website (see attached file).

I'm having an issue with project 2: I can answer question 4 correctly, but not Question 3 (Question 3: How many observations are classified into the “Lower” group? ). With my code:

`data new;set sashelp.shoes;length salesrange \$10.;if (Sales >=0 AND sales < 100000) then salesrange="Lower";else if (Sales >= 100000 AND Sales<= 200000) then salesrange="Middle";else if sales > 200000 then salesrange="Upper";run; proc print data=new;where salesrange = "Lower";run;`

my answer for question 3 is 394, not, as the paper says, 288. Is this an error on the paper or did I make a mistake?

Any help is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Diamond | Level 26

## Re: Error in Practice Questions provided by SAS?

``````proc freq data=new;
tables salesrange;
run;``````

produces this output

```                                                                                  Cumulative    Cumulative
salesrange    Frequency     Percent     Frequency      Percent
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Lower              288       72.91           288        72.91
Middle              60       15.19           348        88.10
Upper               47       11.90           395       100.00

```

so I would say the answer is 288. Your PROC PRINT has observation 394 as the last observation, but the observation numbers are not consecutive so there are not 394 observations printed. Also, the log for your PROC PRINT shows:

```138   proc print data=new;
139   where salesrange = "Lower";
140   run;

NOTE: There were 288 observations read from the data set WORK.NEW.
WHERE salesrange='Lower';
NOTE: PROCEDURE PRINT used (Total process time):
real time           0.03 seconds
cpu time            0.03 seconds

```

so 288 observations were printed.

--
Paige Miller
2 REPLIES 2
Diamond | Level 26

## Re: Error in Practice Questions provided by SAS?

``````proc freq data=new;
tables salesrange;
run;``````

produces this output

```                                                                                  Cumulative    Cumulative
salesrange    Frequency     Percent     Frequency      Percent
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Lower              288       72.91           288        72.91
Middle              60       15.19           348        88.10
Upper               47       11.90           395       100.00

```

so I would say the answer is 288. Your PROC PRINT has observation 394 as the last observation, but the observation numbers are not consecutive so there are not 394 observations printed. Also, the log for your PROC PRINT shows:

```138   proc print data=new;
139   where salesrange = "Lower";
140   run;

NOTE: There were 288 observations read from the data set WORK.NEW.
WHERE salesrange='Lower';
NOTE: PROCEDURE PRINT used (Total process time):
real time           0.03 seconds
cpu time            0.03 seconds

```

so 288 observations were printed.

--
Paige Miller
Calcite | Level 5

## Re: Error in Practice Questions provided by SAS?

Arghh, I'm such a newbie 😞 Thanks so much! This really drove me nuts.
Discussion stats
• 2 replies
• 310 views
• 1 like
• 2 in conversation