<?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: Messy Data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93832#M26613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If no one has explained it, have a look at the documentation of the INPUT statement and give particular attention to "the trailing @ sign"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jul 2013 07:15:54 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2013-07-30T07:15:54Z</dc:date>
    <item>
      <title>Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93825#M26606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have some messy raw data as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question&lt;/P&gt;&lt;P&gt;What is the Capital of Malawi?&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;P&gt;Paris&lt;/P&gt;&lt;P&gt;B.&lt;/P&gt;&lt;P&gt;London&lt;/P&gt;&lt;P&gt;C.&lt;/P&gt;&lt;P&gt;Lilongwe&lt;/P&gt;&lt;P&gt;Question&lt;/P&gt;&lt;P&gt;How many prime numbers are there between 1 - 100?&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;P&gt;Three&lt;/P&gt;&lt;P&gt;B.&lt;/P&gt;&lt;P&gt;Four&lt;/P&gt;&lt;P&gt;C.&lt;/P&gt;&lt;P&gt;five&lt;/P&gt;&lt;P&gt;D.&lt;/P&gt;&lt;P&gt;Can't be determined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would I write a program which will extract a variable question by reading what comes after the observation "Question", and similarly variables A, B, C, D by reading what comes after each of those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pardon me if I have not illustrated my question clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result would look like what it is in the attachment:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jijil Ramakrishnan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Jijil Ramakrishnan&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11818iDC4D42E0CE110443/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Want.png" title="Want.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 15:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93825#M26606</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2013-07-29T15:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93826#M26607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You've illustrated the situation very clearly.&amp;nbsp; But you need to provide a little more guidance on your intended outcome.&amp;nbsp; For example, you could want an outcome that includes one observation per question, and these variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;question&lt;/P&gt;&lt;P&gt;answer_a&lt;/P&gt;&lt;P&gt;answer_b&lt;/P&gt;&lt;P&gt;answer_c&lt;/P&gt;&lt;P&gt;answer_d&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case, you might want to provide the largest possible number of answers per question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you might want an outcome that includes many observations per question, one for each possible answer.&amp;nbsp; The variables might be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;question&lt;/P&gt;&lt;P&gt;answer_code (a, b, c, d ...)&lt;/P&gt;&lt;P&gt;answer_text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you might want to design something slightly different from either of these.&lt;/P&gt;&lt;P&gt;That sort of information would be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ooooops ... looks like your diagram already maps that out.&amp;nbsp; So assuming that you want one observation per question, and that four answers will be the maximum ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;infile rawdata truncover end=alldone;&lt;/P&gt;&lt;P&gt;length test $ 8;&lt;/P&gt;&lt;P&gt;input test;&lt;/P&gt;&lt;P&gt;length question answer_a answer_b answer_c answer_d $ 100;&lt;/P&gt;&lt;P&gt;informat question answer_a answer_b answer_c answer_d $char100.;&lt;/P&gt;&lt;P&gt;retain question answer_a answer_b answer_c answer_d;&lt;/P&gt;&lt;P&gt;keep question answer_a answer_b answer_c answer_d;&lt;/P&gt;&lt;P&gt;if test = 'Question' then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if _n_ &amp;gt; 1 then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; answer_a = ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; answer_b = ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; answer_c = ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; answer_d = ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input question;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else if test='A.' then input question_a;&lt;/P&gt;&lt;P&gt;else if test='B.' then input question_b;&lt;/P&gt;&lt;P&gt;else if test='C.' then input question_c;&lt;/P&gt;&lt;P&gt;else if test='D.' then input question_d;&lt;/P&gt;&lt;P&gt;if alldone then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's untested code, but should be at least approximatley right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 16:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93826#M26607</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-07-29T16:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93827#M26608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Astounding,&lt;/P&gt;&lt;P&gt;This is works. Hats off to your writing untested code with near perfection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This, however, has a problem I can't fix. When it reads a string with more than one word (such as a question), it reads only the first word.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me how can I read the whole line..&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Jijil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 18:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93827#M26608</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2013-07-29T18:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93828#M26609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ooops... I have one more doubt:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose all of rawdata is in SAS format under work.have (sas7bdaat format)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Question&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;What is the Capital of Malawi?&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;A.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Paris&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;B.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;London&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;C.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Lilongwe&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Question&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;How many prime numbers are there between 1 - 100?&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;A.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Three&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;B.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Four&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;C.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;five&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;D.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Can't be determined&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;How do I use a "set" (instead of "infile") to achieve the same?&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thanks in advance,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Jijil Ramakrishnan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 18:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93828#M26609</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2013-07-29T18:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93829#M26610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the original problem, reading just a single word, I thought the INFORMAT would take care of that.&amp;nbsp; I guess SAS needs more explicit instructions.&amp;nbsp; The INFORMAT statement isn't needed, but change 5 INPUT statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input question_a $char100.;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;input question_d $char100.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue about already having a SAS data set to begin is a different animal entirely.&amp;nbsp; What is the variable in your SAS data set?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 19:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93829#M26610</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-07-29T19:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93830#M26611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is already in SAS dataset, the following quick_n_dirty code may help:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; cards4 &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; var;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards4&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Question&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;What is the Capital of Malawi?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Paris&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;London&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Lilongwe&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Question&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;How many prime numbers are there between 1 - 100?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Three&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Four&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;five&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;D.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;Can't be determined&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;merge&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have have(firstobs=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; rename=var=_var) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=last;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; Question $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; A $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; B $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; C&amp;nbsp; $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; D $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; A B C D question;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; and var=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'Question'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; or last &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; missing (a, b, c, d);&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (var);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"Question"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;question=_var;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"A."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp; A=_var;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"B."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp; B=_var;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"C."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp; C=_var;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"D."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp; D=_var;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;otherwise&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _var var;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 19:37:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93830#M26611</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-07-29T19:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93831#M26612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is only one variable named 'record', all of the above are strings are observations in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jijil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 20:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93831#M26612</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2013-07-29T20:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93832#M26613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If no one has explained it, have a look at the documentation of the INPUT statement and give particular attention to "the trailing @ sign"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2013 07:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93832#M26613</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-07-30T07:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93833#M26614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;if the raw file is the exactly in the form as you have mentioned&lt;/P&gt;&lt;P&gt;you could try below code :&lt;/P&gt;&lt;P&gt;date temp;&lt;/P&gt;&lt;P&gt;infile '/path/temp.txt'&amp;nbsp; DLM='09'x DSD MISSOVER;&lt;/P&gt;&lt;P&gt;input mydata $ 50;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp_new;&lt;/P&gt;&lt;P&gt;lenght question $ 50 a $ 25 b $ 25 c $ 25 d $ 25 ;&lt;/P&gt;&lt;P&gt;do i=1 to nobs/10;&lt;/P&gt;&lt;P&gt;m=2+m;&lt;/P&gt;&lt;P&gt;set temp point=m nobs=nobs;&lt;BR /&gt;question=mydata;&lt;/P&gt;&lt;P&gt;m=m+2;&lt;/P&gt;&lt;P&gt;set temp point=m nobs=nobs;&lt;BR /&gt;a=mydata;&lt;/P&gt;&lt;P&gt;m=m+2;&lt;/P&gt;&lt;P&gt;set temp point=m nobs=nobs;&lt;BR /&gt;b=mydata;&lt;/P&gt;&lt;P&gt;m=m+2;&lt;/P&gt;&lt;P&gt;set temp point=m nobs=nobs;&lt;BR /&gt;c=mydata;&lt;/P&gt;&lt;P&gt;m=m+2;&lt;/P&gt;&lt;P&gt;set temp point=m nobs=nobs;&lt;BR /&gt;d=mydata;&lt;/P&gt;&lt;P&gt;retain m;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;if nobs then;&lt;/P&gt;&lt;P&gt;stop&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i believe this will do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2013 11:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93833#M26614</guid>
      <dc:creator>sugeshnambiar</dc:creator>
      <dc:date>2013-07-30T11:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Messy Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93834#M26615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can try the below which is quite simple&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;infile '/path/file.txt' scanover;&lt;/P&gt;&lt;P&gt;input @'question' question $char100.;&lt;/P&gt;&lt;P&gt;input @'a' a $char20.;&lt;/P&gt;&lt;P&gt;input @'b' b $char20.;&lt;/P&gt;&lt;P&gt;input @'c' c $char20.;&lt;/P&gt;&lt;P&gt;input @'d' d $char20.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2013 12:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Messy-Data/m-p/93834#M26615</guid>
      <dc:creator>sugeshnambiar</dc:creator>
      <dc:date>2013-07-30T12:45:24Z</dc:date>
    </item>
  </channel>
</rss>

