<?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: Is there anything wrong with this question? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738591#M80494</link>
    <description>&lt;P&gt;Hello&lt;BR /&gt;I saw this question at atleast two sites online. and the question posed is&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;"Which SAS informat correctly completes the program?" and the given answer is mmddyy10.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The question is properly formatted, but there is space between day, month and year.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_1-1620050047257.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58957i4209E1B44533988E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_1-1620050047257.png" alt="Sajid01_1-1620050047257.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So for the given answer to be true, the employee data file should look like this.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1620049730016.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58955i7E730968A9D403A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1620049730016.png" alt="Sajid01_0-1620049730016.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thus the question needs correction.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268447"&gt;@tianerhu&lt;/a&gt;&amp;nbsp;may have a different source for this question, but the error essentially remains the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 13:57:22 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2021-05-03T13:57:22Z</dc:date>
    <item>
      <title>Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738432#M80465</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tianerhu_0-1619988335094.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58934iCBFCD339CA07593D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tianerhu_0-1619988335094.png" alt="tianerhu_0-1619988335094.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tianerhu_1-1619988346065.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58935i1A1C8045685A1F41/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tianerhu_1-1619988346065.png" alt="tianerhu_1-1619988346065.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tianerhu_2-1619988357278.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58936iE89DF943DDFDF44E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tianerhu_2-1619988357278.png" alt="tianerhu_2-1619988357278.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Can we read the data of the variable Department from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; ?&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 20:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738432#M80465</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2021-05-02T20:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738433#M80466</link>
      <description>&lt;P&gt;I suspect the use of a proportional font is misaligning the data under the column ruler. If StartDate does start in column 15 and takes up 10 columns then Department&amp;nbsp; can correctly start in column 25.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 21:03:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738433#M80466</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-05-02T21:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738459#M80482</link>
      <description>&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 23:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738459#M80482</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2021-05-02T23:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738569#M80491</link>
      <description>&lt;P&gt;I would be very careful with any training material (an assumption on my part) that ever shows log text using proportional fonts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are diagnostic characters, such as the ruler or underscore charters that indicate the position of an error the results are not easy to read and indicates poor preparation by the publisher. i.e. they don't know that logs rely on character positions which would make me question how well they know the other material.&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 12:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738569#M80491</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-03T12:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738591#M80494</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;I saw this question at atleast two sites online. and the question posed is&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;"Which SAS informat correctly completes the program?" and the given answer is mmddyy10.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The question is properly formatted, but there is space between day, month and year.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_1-1620050047257.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58957i4209E1B44533988E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_1-1620050047257.png" alt="Sajid01_1-1620050047257.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So for the given answer to be true, the employee data file should look like this.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1620049730016.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58955i7E730968A9D403A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1620049730016.png" alt="Sajid01_0-1620049730016.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thus the question needs correction.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268447"&gt;@tianerhu&lt;/a&gt;&amp;nbsp;may have a different source for this question, but the error essentially remains the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 13:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738591#M80494</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-03T13:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738714#M80496</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131732"&gt;@Sajid01&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;BR /&gt;I saw this question at atleast two sites online. and the question posed is&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;"Which SAS informat correctly completes the program?" and the given answer is mmddyy10.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The question is properly formatted, but there is space between day, month and year.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_1-1620050047257.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58957i4209E1B44533988E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_1-1620050047257.png" alt="Sajid01_1-1620050047257.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So for the given answer to be true, the employee data file should look like this.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1620049730016.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58955i7E730968A9D403A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1620049730016.png" alt="Sajid01_0-1620049730016.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thus the question needs correction.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268447"&gt;@tianerhu&lt;/a&gt;&amp;nbsp;may have a different source for this question, but the error essentially remains the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The spaces are acceptable when using fixed column data. Example:&lt;/P&gt;
&lt;PRE&gt;data junk;
  input x ddmmyy10.;
  format x date9.;
datalines;
 2 10 2021
;&lt;/PRE&gt;
&lt;P&gt;Abbreviated but in this case x is being read from all 10 columns and gets 02OCT2021 correctly. Which is why the PICTURE of the Ruler has to be accurate, the code shown says the date value is to be read starting at column 15 but the picture the OP shows does not show proper alignment for the stated informat to work. The first 2 would have to appear under the - after the + between 10 and 20 (the + then being column 15). Column 25, where the variable Department is supposed to start appears to be in the middle of the date values in picture shown. Which is why I would be very hesitant to use the version of the examples provided if the OP is showing a good copy of the material.&lt;/P&gt;
&lt;P&gt;An approach that uses LIST format such as the following will interpret the space as delimiter between variables and fail as expected.&lt;/P&gt;
&lt;PRE&gt;data junk;
  input x :ddmmyy10.;
  format x date9.;
datalines;
 2 10 2021
;
/*or*/
data junk;
  informat x ddmmyy10.;
  input x ;
  format x date9.;
datalines;
 2 10 2021
;&lt;/PRE&gt;
&lt;P&gt;Remember there are 4 different types of INPUT and how they can be mixed on an input statement is truly one of SAS's strengths.&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 21:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738714#M80496</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-03T21:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738922#M80507</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;for the wonderful explanation.&lt;BR /&gt;There is so much I need to learn.&amp;nbsp;&lt;BR /&gt;Looks like there is an error in my code.&lt;BR /&gt;Can you please help me understand where I am going wrong. My code and operative portion of the log are reproduced&amp;nbsp; below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*My code */
data employee;
infile "/home/testuser/employee2.txt";
Retain FirstName StartDate Department;
informat StartDate ddmmyy10.;
format startDate date9.;
input @1  FirstName $
      @15 StartDate 
      @25 Department $
      ;    
run;
/* My log*/
NOTE: Invalid data for StartDate in line 1 15-15.
 RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                      
 1         Xing          2 19 2004 ACCT 28
 FirstName=Xing StartDate=. Department=ACCT _ERROR_=1 _N_=1
 NOTE: Invalid data for StartDate in line 2 15-15.
 2         Bob           5 22 2004 MKTG 28
 FirstName=Bob StartDate=. Department=MKTG _ERROR_=1 _N_=2
 NOTE: Invalid data for StartDate in line 3 15-15.
 3         Jorge         3 14 2004 EDUC 28
 FirstName=Jorge StartDate=. Department=EDUC _ERROR_=1 _N_=3
 NOTE: 3 records were read from the infile "/home/testuser/employee2.txt".
       The minimum record length was 28.
       The maximum record length was 28.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have also attached the data file I am using.&lt;BR /&gt;Thanks once again.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 14:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738922#M80507</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-04T14:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738942#M80510</link>
      <description>&lt;P&gt;Three things.&lt;/P&gt;
&lt;P&gt;First when you supply an informat and do not explicitly provide the columns the data is read from on the input statement then SAS reverts to list input.&lt;/P&gt;
&lt;P&gt;Second the informat in your code is wrong. You are using DDMMYYYY but to read a value like " 2 19 2004" the data starts with MONTH (MM) not Day. MM can only have values of 01 to 12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to use a method that forces reading all the characters with the informat and that is having the informat on the INPUT statement to force inclusion of the spaces.&lt;/P&gt;
&lt;PRE&gt;data employee;
/*infile "/home/testuser/employee2.txt";*/
format startDate date9.;
input @1  FirstName $
      @15 StartDate mmddyy10. 
      @25 Department $
      ;    
datalines;
Xing          2 19 2004 ACCT
Bob           5 22 2004 MKTG
Jorge         3 14 2004 EDUC
;   &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738942#M80510</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-04T15:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anything wrong with this question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738946#M80511</link>
      <description>&lt;P&gt;Thanks for correcting my code and it worked. I used the following.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data employee;
infile "/home/theprogmin/employee2.txt";
Retain FirstName StartDate Department;
*informat StartDate mmddyy10.;
format startDate date9.;
input @1  FirstName $
      @15 StartDate mmddyy10.
      @25 Department $
      ;    
run;
      &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks once again.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Is-there-anything-wrong-with-this-question/m-p/738946#M80511</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-04T15:21:06Z</dc:date>
    </item>
  </channel>
</rss>

