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?
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.
Please post the complete log (all code, all messages) by copy/pasting it into a window opened with this button:
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;
@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.
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
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.
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
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).
libname pg1 "/home/u44465073/EPG1V2/data";
this is the libname statement I use
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.
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?
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.
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. 🙂
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.