Hello, i am currently trying to score an 80 on the prac exam but SAS has been a bit difficult for me to catch on.
Currently, i am reviewing my practice exam answers.
I will display my code and the assumed correct code. However, the answers are vague and don't show how I can get the answer. This code also heavily puzzled me initally at first.
here is the prompt to create the code initally in the prac exam;
The question i'm struggling with is
"What is the MEAN Kilograms value for group=‘A’ in the results.output36 data set?"
and of course the same, but for group B.
My code:
data cleandata36; set cert.input36; Group=Upcase(group); if Group in ('A', 'B') then output; run; proc means data=cleandata36 median maxdec=0; class Group; var Kilograms; run; data results.output36; set cleam data36; if 40 < kilograms < 200 < then do; if Group = 'A' then kilograms=79; else Kilograms=89; end; run;
Suggested correct code:
data work.cleandata36; set cert.input36; group=upcase(group); if group in ('A', 'B'); run; proc means data=work.cleandata36 median; class group; var kilograms; run; data results.output36; set cleandata36; if Kilograms<30 or Kilograms>200 then do; if group='A' then kilograms=79; else kilograms=89; end; run; proc contents data=results.output36; run;
The mean that I found that was also indicated in the correct answer was 79 for group A, and 89 for group B.
however, the answers given was 76.3 for group A, and 86.5 for group b. I can't find the median in the results nor output data. I'm not sure where to look.
I'm assuming it's because of maxdec?...hopefully? if not, why?
Please go easy on me with terminology/wording.
Iam also actively looking for a tutor if anyone knows one or would like to help because again i am STRUGGLING with learning a lot of these. videos are more difficult than it is with someone that can answer my questions asap because there is so many. thank you haha.
lastly if you are also studying for your exam, we got this! please send me a message and hopefully we can help each other. thank you for your time!
One thing to look at: the requirement Ensure that all values for variable Kilograms are between 40 and 200, inclusively.
Inclusively means that 40 and 200 are in the output.
Your code
if 40 < kilograms < 200 < then do;
Has a serious issue with the third <, which I suspect you did not run successfully , and the rest excludes 40 and 200.
Your "then do" would change the values of kilograms in the specified range not the missing or out of range values to ALL of the supposedly kept values to the median
There may be a problem with the instructions and the suggested code. Your copy of the requirement says 40 to 200
but the suggested code is using 30 and 200 as boundaries. So either your instructions are not copied correctly or the suggested code is using a different set of boundaries. So double check that.
You haven't provided an example of the cert.input36 so there isn't a way to check exactly.
If you can write a data step with the actual values we can provide some more details. A data step with the values would look something like:
data have; input group $ kilograms; datalines; a 123 B 88 c 345 ;
but with more lines to read.
Note: It is often a very good idea to provide the LOG of the code you used because it will show 1) what you actually submitted and 2) it often provides some of the answers, or details of the answers to questions about "why does my code not do the expected <something about the output goes here> ?"
Just a note on preparation process and some insights that we have learned over time. It appears to me from this thread that you are using the practice exam early in your preparation process as a method to 'learn SAS.' I would caution against this. Rather, I would recommend using the Exam Content Guide, the recommended training courses, the exam prep guide, and time coding in SAS to 'learn SAS.' Then, once you have gained a solid understanding of SAS programming, then use the practice exam to check that you are ready for the actual exam. Using the practice exam to guide your learning will cause you to (to use a statistical modeling term) 'overfit' your knowledge to the practice exam.
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