<?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: How to read the variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507649#M32355</link>
    <description>&lt;P&gt;i'd love to but I don't have sas software at home. I'm sure somebody will give you the code , if not I'll tomorrow morning&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2018 04:54:18 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-10-26T04:54:18Z</dc:date>
    <item>
      <title>How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507641#M32350</link>
      <description>&lt;P&gt;data springgrads;&lt;BR /&gt;infile cards dsd dlm= ' '&lt;BR /&gt;input students $15 concentration $15 GPA;&lt;BR /&gt;cards;&lt;BR /&gt;Johnson,Allison Biochemistry 2.56&lt;BR /&gt;Davis,jeffrey General Biology 3.91&lt;BR /&gt;Hall,Baniel Genetics 3.43&lt;BR /&gt;Hill,Courtney Ecology 4.00&lt;BR /&gt;Scott,Tiffany plan Biology 2.56&lt;BR /&gt;Martines Terasa zoology 3.21&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please let me how i can read the above data. thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 03:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507641#M32350</guid>
      <dc:creator>Best</dc:creator>
      <dc:date>2018-10-26T03:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507644#M32351</link>
      <description>&lt;P&gt;is this name&amp;nbsp;&lt;SPAN&gt;Martines Terasa separated by blank&amp;nbsp; making the&amp;nbsp; name values separated by blank or comma?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 04:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507644#M32351</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T04:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507645#M32352</link>
      <description>Sorry I missed to mention comma between them&lt;BR /&gt;&lt;BR /&gt;Martinez,Terasa</description>
      <pubDate>Fri, 26 Oct 2018 04:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507645#M32352</guid>
      <dc:creator>Best</dc:creator>
      <dc:date>2018-10-26T04:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507646#M32353</link>
      <description>&lt;P&gt;You probably will&amp;nbsp; need&lt;STRONG&gt; call scan&lt;/STRONG&gt; to the get the position of the 3rd variable and&lt;STRONG&gt; $varying informat&lt;/STRONG&gt; to read the value of 2nd&amp;nbsp; by calculating the length using the position&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How i wish I was sitting with sas software to demo &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; so sorry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2nd&amp;nbsp;option : you could use _infile_ var and scan the _infile_ with a loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3rd: APP&amp;nbsp; functions instead of scan mentioned in&amp;nbsp; 2nd&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 04:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507646#M32353</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T04:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507648#M32354</link>
      <description>Is there any other method, please write the code?</description>
      <pubDate>Fri, 26 Oct 2018 04:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507648#M32354</guid>
      <dc:creator>Best</dc:creator>
      <dc:date>2018-10-26T04:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507649#M32355</link>
      <description>&lt;P&gt;i'd love to but I don't have sas software at home. I'm sure somebody will give you the code , if not I'll tomorrow morning&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 04:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507649#M32355</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T04:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507652#M32356</link>
      <description>&lt;P&gt;Have you tried what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; suggested? What problems you ran into?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a solution without call scan using char-functions to extract the data from the input-buffer. I am almost sure that there is a solution using only input-statement and some funky options.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data springgrads;
   length 
      student $ 30 
      concentration $ 15 
      GPA 8
      c_start c_length 8
   ;

   drop c_start c_length;

   format GPA 5.2;

   infile cards;
   input;

   Student = scan(_infile_, 1, ' ');
   c_start = findc(_infile_, ' ') + 1;
   c_length = anydigit(_infile_) - c_start;
   Concentration = substr(_infile_, c_start, c_length);
   GPA = input(scan(_infile_, countw(_infile_, ', '), ', '), best32.);  

   cards;
Johnson,Allison Biochemistry 2.56
Davis,jeffrey General Biology 3.91
Hall,Baniel Genetics 3.43
Hill,Courtney Ecology 4.00
Scott,Tiffany plan Biology 2.56
Martines,Terasa zoology 3.21
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Oct 2018 05:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507652#M32356</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-10-26T05:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507672#M32358</link>
      <description>&lt;P&gt;Please make sure your code works before posting.&amp;nbsp; With a few changes:&lt;/P&gt;
&lt;PRE&gt;data springgrads;
  infile cards dsd dlm=' ';
  length students concentration $15;
  input students $ concentration $ GPA;
datalines;
Johnson,Allison Biochemistry 2.56
Davis,jeffrey General Biology 3.91
Hall,Baniel Genetics 3.43
Hill,Courtney Ecology 4.00
Scott,Tiffany plan Biology 2.56
Martines Terasa zoology 3.21
;
run;&lt;/PRE&gt;
&lt;P&gt;It now runs.&amp;nbsp; However it will not give you the required output and the reason is simple.&amp;nbsp; Data needs to a definitive and unique delimiter character value.&amp;nbsp; In your given data you do not have this.&amp;nbsp; Therefore it comes down to you to code in the logic required to pull out each data item, there is not automated method to guess based on a garbage data source.&amp;nbsp; If it was me I would be sending the data back with instructions on how to create a well formed data source.&amp;nbsp; So to get your data to work correctly:&lt;/P&gt;
&lt;PRE&gt;data springgrads;
  infile cards dsd dlm=' ';
  length students concentration $15;
  input students $ concentration $ GPA;
datalines;
"Johnson,Allison" "Biochemistry" 2.56
"Davis,jeffrey" "General Biology" 3.91
"Hall,Baniel" "Genetics" 3.43
"Hill,Courtney" "Ecology" 4.00
"Scott,Tiffany" "plan Biology" 2.56
"Martines Terasa" "zoology" 3.21
;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Oct 2018 08:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507672#M32358</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-26T08:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507774#M32361</link>
      <description>&lt;P&gt;Good morning&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/237014"&gt;@Best&lt;/a&gt;&amp;nbsp;and others in the thread, I thought you would have tried something and come back to us for further clarification/questions. Anyways here you go:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data springgrads;
infile cards truncover col=_c ;
input students : $15. @;
call scan(_infile_, -1, _p, _length,' ');
_l=_p-1-_c;
input concentration $varying15. _l GPA;
drop _:;
cards;
Johnson,Allison Biochemistry 2.56
Davis,jeffrey General Biology 3.91
Hall,Baniel Genetics 3.43
Hill,Courtney Ecology 4.00
Scott,Tiffany plan Biology 2.56
Martines,Terasa zoology 3.21
;
run; 

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Oct 2018 15:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507774#M32361</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T15:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507806#M32362</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/237014"&gt;@Best&lt;/a&gt;&amp;nbsp;Another one although I like the previous one(personal preference)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data springgrads;
infile cards truncover ;
informat students $15. concentration $15.;
input  @;
GPA=input(scan(_infile_,-1,' '),8.);
_infile_=substr(_infile_,1 ,anydigit(_infile_)-1);
input students  concentration &amp;amp; ;
cards;
Johnson,Allison Biochemistry 2.56
Davis,jeffrey General Biology 3.91
Hall,Baniel Genetics 3.43
Hill,Courtney Ecology 4.00
Scott,Tiffany plan Biology 2.56
Martines,Terasa zoology 3.21
;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 16:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-read-the-variable/m-p/507806#M32362</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-26T16:19:22Z</dc:date>
    </item>
  </channel>
</rss>

