<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Scenario 2 - Base Programmer  Prep Guide in SAS Certification</title>
    <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589218#M640</link>
    <description>&lt;P&gt;It is better to post LOG or Code in a code box opened using the Forum's {I} or "running man" icons. Copy from the log and in the forum click on the icon, paste into the code box.&lt;/P&gt;
&lt;P&gt;Much simpler than creating a separate file and attaching. Plus the messages can be seen in line and it is easier for others to copy and paste or highlight stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example (though this got reformatted because of Copy from a PDF)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;73 libname certdata xlsx '/folders/myfolders/Prep Guide Data/base-guide-practice-data/cert/heart.xlsx' ;
NOTE: Libref CERTDATA was successfully assigned as follows:
Engine: XLSX
Physical Name: /folders/myfolders/Prep Guide Data/base-guide-practice-data/cert/heart.xlsx
74 data work.heart ;
75 set certdata.heart (drop=AgeAtDeath DeathCause) ;
ERROR: The variable AgeAtDeath in the DROP, KEEP, or RENAME list has never been referenced.
76 where Status='Alive' ;
77 if AgeCHDdiag=. then delete ;
78 length Smoking_Status $17 ;
79 if 0&amp;lt;=Smoking&amp;lt;6 then Smoking_Status = 'Non-Smoker(0-5)' ;
80 else if 6&amp;lt;=Smoking&amp;lt;=15 then Smoking_Status='Moderate (6-15)' ;
81 else if 16&amp;lt;=Smoking&amp;lt;=25 then Smoking_Status='Heavy (16-25)' ;
82 else if Smoking&amp;gt;25 then Smoking_Status='Very Heavy (&amp;gt;25)' ;
83 else Smoking_Status='Error' ;
84 run ;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.HEART may be incomplete. When this step was stopped there were 0 observations and 3 variables.
WARNING: Data set WORK.HEART was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.79 seconds
cpu time 0.76 seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Some thing to check: Does the XLSX file have a column heading "AgeAtDeath" or did someone manage to create one like "Age At Death"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And again, the link shown by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73569"&gt;@sabisw&lt;/a&gt;&amp;nbsp;should be checked.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 23:22:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-16T23:22:47Z</dc:date>
    <item>
      <title>Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589181#M635</link>
      <description>&lt;P&gt;I have a question about scenario 2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The directions state to remove observations with RestHR values &amp;gt;= 70 and to remove TotalTime values &amp;lt; 600.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data stress1 ;
	set cert.stress ;
	if RestHR &amp;gt;= 70 then delete ; 
	TotalTime=(TimeMin*60) + TimeSec ;
	if TotalTime &amp;lt; 600 then delete ;
run ;

proc print data=stress1 ;
run ;&lt;/PRE&gt;&lt;P&gt;My answers are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. 4 observations&lt;/P&gt;&lt;P&gt;2. 1055&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The answers in the prep guide are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. 5&lt;/P&gt;&lt;P&gt;2. 1055&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand why the where clause is used.&amp;nbsp; The answer code says to use a where statement to determine the RestHR values.&amp;nbsp; Ex:&amp;nbsp; where RestHR &amp;lt;= 70.&amp;nbsp; This doesn't make sense to me because the instructions state to&amp;nbsp;&lt;STRONG&gt;remove&lt;/STRONG&gt; values &amp;gt;=70 for RestHR and&amp;nbsp;&lt;STRONG&gt;remove&lt;/STRONG&gt; values for TotalTime &amp;lt; 600.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached are the instructions.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 20:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589181#M635</guid>
      <dc:creator>CPoston</dc:creator>
      <dc:date>2019-09-16T20:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589185#M636</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/228030"&gt;@CPoston&lt;/a&gt; Hey there!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure if you had a chance yet to do so or not, but check out the &lt;A href="https://support.sas.com/content/dam/SAS/support/en/books/errata-base-certified.pdf" target="_self"&gt;Content Updates&lt;/A&gt; page.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best practice is to use the WHERE statement. WHERE statement works on variables in the data set that we are reading and is a preprocessor. You can use the IF-THEN statement for the second part where you are removing values for TotalTime that are less than 600 because you are creating the variable TotalTime in the step above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Samantha&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 20:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589185#M636</guid>
      <dc:creator>sabisw</dc:creator>
      <dc:date>2019-09-16T20:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589206#M637</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73569"&gt;@sabisw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the explanation!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I was working through the scenario's, another question came up.&amp;nbsp; I think I have the wrong data for Scenario 6.&amp;nbsp; Attached is the proc contents for the heart.xlsx file I have.&amp;nbsp; I will attach the log that generated from my code and the log with the SAS code in the answer section in a separate post since it only lets me attach one at a time.&amp;nbsp; There is no variable AgeAtDeath and the Smoking_Status variable is already created. Please advise.&amp;nbsp; Thanks!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         libname certdata xlsx '/folders/myfolders/Prep Guide Data/base-guide-practice-data/cert/heart.xlsx' ;
 NOTE: Libref CERTDATA was successfully assigned as follows: 
       Engine:        XLSX 
       Physical Name: /folders/myfolders/Prep Guide Data/base-guide-practice-data/cert/heart.xlsx
 74         data work.heart ;
 75         set certdata.heart (drop=AgeAtDeath DeathCause) ;
 ERROR: The variable AgeAtDeath in the DROP, KEEP, or RENAME list has never been referenced.
 76         where Status='Alive' ;
 77         if AgeCHDdiag=. then delete ;
 78         length Smoking_Status $17 ;
 79         if 0&amp;lt;=Smoking&amp;lt;6 then Smoking_Status = 'Non-Smoker(0-5)' ;
 80         else if 6&amp;lt;=Smoking&amp;lt;=15 then Smoking_Status='Moderate (6-15)' ;
 81         else if 16&amp;lt;=Smoking&amp;lt;=25 then Smoking_Status='Heavy (16-25)' ;
 82         else if Smoking&amp;gt;25 then Smoking_Status='Very Heavy (&amp;gt;25)' ;
 83         else Smoking_Status='Error' ;
 84         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.HEART may be incomplete.  When this step was stopped there were 0 observations and 3 variables.
 WARNING: Data set WORK.HEART was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.79 seconds
       cpu time            0.76 seconds
       
 
 85         
 86         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 98         
&lt;/PRE&gt;
&lt;P&gt;My log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         data heart2 ;
 74         set heart (drop=AgeAtDeath DeathCause) ;
 ERROR: The variable AgeAtDeath in the DROP, KEEP, or RENAME list has never been referenced.
 75         length Smoking_Status $17 ;
 76         where Status='Alive' ;
 77         if AgeCHDdiag=. then delete ;
 78         if Smoking &amp;gt;0 and &amp;lt;6 then Smoking_Status='None (0-5)' ;
                               _       _______________
                               22      180           180
 79         else if Smoking &amp;gt;=6 and &amp;lt;= 15 then Smoking_Status='Moderate (6-15)' ;
                                     __         _______________
                                     22         180           180
 80         else if Smoking &amp;gt;=16 and &amp;lt;=25 then Smoking_Status='Heavy (16-25)' ;
                                      __        _______________
                                      22        180           180
 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
               a missing value, INPUT, PUT.  
 
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 
 81         else if Smoking &amp;gt;25 then Smoking_Status='Very Heavy (&amp;gt;25)' ;
 82         else Smoking_Status = 'Error' ;
 83         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.HEART2 may be incomplete.  When this step was stopped there were 0 observations and 3 variables.
 WARNING: Data set WORK.HEART2 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 84         
 85         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 97         
&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Sep 2019 01:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589206#M637</guid>
      <dc:creator>CPoston</dc:creator>
      <dc:date>2019-09-17T01:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589207#M638</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73569"&gt;@sabisw&lt;/a&gt;&amp;nbsp;SAS Log&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 22:08:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589207#M638</guid>
      <dc:creator>CPoston</dc:creator>
      <dc:date>2019-09-16T22:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589208#M639</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73569"&gt;@sabisw&lt;/a&gt;&amp;nbsp;my log&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 22:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589208#M639</guid>
      <dc:creator>CPoston</dc:creator>
      <dc:date>2019-09-16T22:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589218#M640</link>
      <description>&lt;P&gt;It is better to post LOG or Code in a code box opened using the Forum's {I} or "running man" icons. Copy from the log and in the forum click on the icon, paste into the code box.&lt;/P&gt;
&lt;P&gt;Much simpler than creating a separate file and attaching. Plus the messages can be seen in line and it is easier for others to copy and paste or highlight stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example (though this got reformatted because of Copy from a PDF)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;73 libname certdata xlsx '/folders/myfolders/Prep Guide Data/base-guide-practice-data/cert/heart.xlsx' ;
NOTE: Libref CERTDATA was successfully assigned as follows:
Engine: XLSX
Physical Name: /folders/myfolders/Prep Guide Data/base-guide-practice-data/cert/heart.xlsx
74 data work.heart ;
75 set certdata.heart (drop=AgeAtDeath DeathCause) ;
ERROR: The variable AgeAtDeath in the DROP, KEEP, or RENAME list has never been referenced.
76 where Status='Alive' ;
77 if AgeCHDdiag=. then delete ;
78 length Smoking_Status $17 ;
79 if 0&amp;lt;=Smoking&amp;lt;6 then Smoking_Status = 'Non-Smoker(0-5)' ;
80 else if 6&amp;lt;=Smoking&amp;lt;=15 then Smoking_Status='Moderate (6-15)' ;
81 else if 16&amp;lt;=Smoking&amp;lt;=25 then Smoking_Status='Heavy (16-25)' ;
82 else if Smoking&amp;gt;25 then Smoking_Status='Very Heavy (&amp;gt;25)' ;
83 else Smoking_Status='Error' ;
84 run ;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.HEART may be incomplete. When this step was stopped there were 0 observations and 3 variables.
WARNING: Data set WORK.HEART was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.79 seconds
cpu time 0.76 seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Some thing to check: Does the XLSX file have a column heading "AgeAtDeath" or did someone manage to create one like "Age At Death"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And again, the link shown by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73569"&gt;@sabisw&lt;/a&gt;&amp;nbsp;should be checked.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 23:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589218#M640</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-16T23:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589226#M641</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;, I'll update.&amp;nbsp; I thought you could only put code in there.&amp;nbsp; The xlsx file does not have a column called Age At Death and there aren't any instructions to create it.&amp;nbsp; I checked the errata in the link from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73569"&gt;@sabisw&lt;/a&gt;&amp;nbsp;and there is no mention about the heart.xlsx file for scenario 6.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 01:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589226#M641</guid>
      <dc:creator>CPoston</dc:creator>
      <dc:date>2019-09-17T01:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Scenario 2 - Base Programmer  Prep Guide</title>
      <link>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589363#M642</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/228030"&gt;@CPoston&lt;/a&gt;,&amp;nbsp;I'm attaching the correct Excel file for you to use. I apologize, our sample data has created the Certdata.Heart instead of the Excel file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 13:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Certification/Scenario-2-Base-Programmer-Prep-Guide/m-p/589363#M642</guid>
      <dc:creator>sabisw</dc:creator>
      <dc:date>2019-09-17T13:47:07Z</dc:date>
    </item>
  </channel>
</rss>

