BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ohaetok
Fluorite | Level 6

Hi, I copied the SAS code from the solution into SAS Studio and my results show that the values of SqMiles and Camping in row one are  0. However, the solution says: SqMiles is 1,014 and the value of Camping is 6,375". 

 

Is anyone else having this issue?

1 ACCEPTED SOLUTION

Accepted Solutions
shaun_w
Fluorite | Level 6

I had the same issue with this question. It's a poorly written question and needs to be revised to specify what park they want as the answer instead of "Row 1" 

In my 'row 1' slot without using any kind of sort -- because the question doesn't specify to sort -- was Noatak National Preserve. 

There are several parks that are very small, and I'm guessing the original poster was using one of the parks that show 0 and 0, such as African Burial Grounds NM or Aztec Ruins NM possibly. 

The correct answer uses Cape Krusenstern National Monument as the correct location. But I have no idea how they would ever arrive at that park ending up in Row 1. 

Unless I am missing something obvious, please let me know if I am, this is a very very poor question that needs to be revisited and revised. 

 

shaun_w_0-1681445132578.png

 

View solution in original post

13 REPLIES 13
ohaetok
Fluorite | Level 6
data np_summary_update;
    set pg1.np_summary;
    keep Reg ParkName DayVisits OtherLodging Acres SqMiles Camping;
    SqMiles=Acres*.0015625;
    Camping=sum(OtherCamping,TentCampers,
                RVCampers,BackcountryCampers);
    format SqMiles comma6. Camping comma10.;
run;
PaigeMiller
Diamond | Level 26

@ohaetok wrote:
data np_summary_update;
    set pg1.np_summary;
    keep Reg ParkName DayVisits OtherLodging Acres SqMiles Camping;
    SqMiles=Acres*.0015625;
    Camping=sum(OtherCamping,TentCampers,
                RVCampers,BackcountryCampers);
    format SqMiles comma6. Camping comma10.;
run;

The log was requested. This is not the log.

--
Paige Miller
ohaetok
Fluorite | Level 6
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         data np_summary_update;
 70             set pg1.np_summary;
 71             keep Reg ParkName DayVisits OtherLodging Acres SqMiles Camping;
 72             SqMiles=Acres*.0015625;
 73             Camping=sum(OtherCamping,TentCampers,
 74                         RVCampers,BackcountryCampers);
 75             format SqMiles comma6. Camping comma10.;
 76         run;
 
 NOTE: There were 135 observations read from the data set PG1.NP_SUMMARY.
 NOTE: The data set WORK.NP_SUMMARY_UPDATE has 135 observations and 7 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              959.75k
       OS Memory           22440.00k
       Timestamp           01/17/2023 10:03:07 PM
       Step Count                        55  Switch Count  2
       Page Faults                       0
       Page Reclaims                     165
       Page Swaps                        0
       Voluntary Context Switches        18
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 77         
 78         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 88         
PaigeMiller
Diamond | Level 26

So you are getting zero values where you expect non-zero values. Your code does not produce errors, as shown in the log. So the problem must be that the data contains values that are not expected. Please LOOK AT the data set named pg1.np_summary with your own eyes to see if you can figure out why you are getting zeros.

--
Paige Miller
Cynthia_sas
SAS Super FREQ

Hi:
I just tested the code and got the same correct results as that shown in the answer for the question (1014 and 6375). So I can't duplicate your experience.

The fact that you're getting 0 indicates to me that something might be wrong with your LIBNAME statement or possibly your input data set got accidentally deleted or corrupted. Did you see any Physical File not found messages in the log?

In the np_summary_update data set that you create, the first row should be for Cape Krusenstern National Monument with SqMiles and Camping as indicated above. When you check the input data in pg1.np_summary, the data should have 135 rows and 10 variables. After you run your program, the work.np_summary_update data set should have 135 rows and 7 variables (because of the recommended KEEP).
Cynthia

ohaetok
Fluorite | Level 6

Hi, it doesn't seem like there is anything wrong with the files, unless I am missing something.  I am still getting 0 as the answers. I attached pictures of the code, the results for the modified table ( total rows:135, total columns 7), and results for the original table ( total rows:135, total columns: 10).

 

ohaetok
Fluorite | Level 6
libname pg1 "/home/u44465073/EPG1V2/data";

this is the libname statement I use

shaun_w
Fluorite | Level 6

I had the same issue with this question. It's a poorly written question and needs to be revised to specify what park they want as the answer instead of "Row 1" 

In my 'row 1' slot without using any kind of sort -- because the question doesn't specify to sort -- was Noatak National Preserve. 

There are several parks that are very small, and I'm guessing the original poster was using one of the parks that show 0 and 0, such as African Burial Grounds NM or Aztec Ruins NM possibly. 

The correct answer uses Cape Krusenstern National Monument as the correct location. But I have no idea how they would ever arrive at that park ending up in Row 1. 

Unless I am missing something obvious, please let me know if I am, this is a very very poor question that needs to be revisited and revised. 

 

shaun_w_0-1681445132578.png

 

StaceySyphus
SAS Employee

Thank you for the input. I'm guessing what happened is that you permanently sorted the table in a prior practice, which obviously impacted the order for this practice. I've updated the question in the course to this: What are the values of SqMiles and Camping when ParkName is Cape Krusenstern National Monument?

shaun_w
Fluorite | Level 6
That is very possible, thank you for the feedback.
shaun_w
Fluorite | Level 6

To kinda close the loop on this, I went back to the data set to see if I did sort it using PROC CONTENTS. When I pulled up the PROC CONTENTS for the temporary dataset we created, 'np_summary_update,' it shows that it wasn't sorted, but it does show that I sorted by Descending Acres when I use PROC CONTENTS on the original pg1.np_summary data. That was helpful to go back and look at that once you mentioned it, I'll keep that in mind moving forward, thank you.

StaceySyphus
SAS Employee

Thanks for following up!  Good learning exercise...  Regardless, your suggestion was valid to change the question so that it doesn't depend on a particular sort order.  I appreciate you taking the time to provide the feedback and see it through to the end. That helps us improve our training. 🙂

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 13 replies
  • 2247 views
  • 2 likes
  • 6 in conversation