<?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: sas does not recognize the comma between observation in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550762#M16913</link>
    <description>&lt;P&gt;libname ab'path'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;set ab.pre;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just used the import command from the file menu and imported the CSV&amp;nbsp;file(on my local drive) and named it pre. It read all the variables and observations perfectly fine.&lt;/P&gt;&lt;P&gt;then I used the proc freq for the variable eth which&amp;nbsp;had the above-mentioned issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = new;&lt;BR /&gt;table eth;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2019 19:42:03 GMT</pubDate>
    <dc:creator>vijay24</dc:creator>
    <dc:date>2019-04-12T19:42:03Z</dc:date>
    <item>
      <title>sas does not recognize the comma between observation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550744#M16911</link>
      <description>&lt;P&gt;I have a variable with categorical observation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id eth&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 1,2,3&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; 2,5&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp;4&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is present in a csv&amp;nbsp;format file. When i import the data, SAS does not recognize the comma between the observations. My proc freq appears something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eth frequency&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1258&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;456&lt;/P&gt;&lt;P&gt;13&amp;nbsp; &amp;nbsp; 445&lt;/P&gt;&lt;P&gt;14&amp;nbsp; &amp;nbsp; 454&lt;/P&gt;&lt;P&gt;16&amp;nbsp; &amp;nbsp; &amp;nbsp;23&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of 13, 14, 16, I want sas&amp;nbsp;to recognize they are separate option like 1 and 3, 1 and 4. My goal is to count the total 1s,2s,3s and so on. But here instead of 1and 3, the observation appears as 13.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 18:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550744#M16911</guid>
      <dc:creator>vijay24</dc:creator>
      <dc:date>2019-04-12T18:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: sas does not recognize the comma between observation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550757#M16912</link>
      <description>&lt;P&gt;Please show us the SAS code you are using.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550757#M16912</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-12T19:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: sas does not recognize the comma between observation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550762#M16913</link>
      <description>&lt;P&gt;libname ab'path'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;set ab.pre;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just used the import command from the file menu and imported the CSV&amp;nbsp;file(on my local drive) and named it pre. It read all the variables and observations perfectly fine.&lt;/P&gt;&lt;P&gt;then I used the proc freq for the variable eth which&amp;nbsp;had the above-mentioned issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = new;&lt;BR /&gt;table eth;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550762#M16913</guid>
      <dc:creator>vijay24</dc:creator>
      <dc:date>2019-04-12T19:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: sas does not recognize the comma between observation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550774#M16915</link>
      <description>&lt;P&gt;I guess that when you read&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id eth&lt;/P&gt;
&lt;P&gt;1 1&lt;/P&gt;
&lt;P&gt;2 1,2,3&lt;/P&gt;
&lt;P&gt;3 2,5&lt;/P&gt;
&lt;P&gt;4 4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you expect the second line to become three observations. The Import proc will not do that. You will need a more refined input step to read that data the way you intend.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 20:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550774#M16915</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-12T20:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: sas does not recognize the comma between observation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550775#M16916</link>
      <description>&lt;P&gt;If you have a dataset like that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input id eth $30.;
cards;
1   1
2    1,2,3
3    2,5
4     4  
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The you will get a frequency count like:&lt;/P&gt;
&lt;PRE&gt;                                  Cumulative    Cumulative
eth      Frequency     Percent     Frequency      Percent
------------------------------------------------------------------------------
1               1       25.00             1        25.00
1,2,3           1       25.00             2        50.00
2,5             1       25.00             3        75.00
4               1       25.00             4       100.00
&lt;/PRE&gt;
&lt;P&gt;If you want treat those comma separated values as separate records/response then first convert the data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  do i=1 to max(1,countw(eth,','));
    ethnum = scan(eth,i,',');
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;The FREQ Procedure

                                   Cumulative    Cumulative
ethnum    Frequency     Percent     Frequency      Percent
----------------------------------------------------------------------------
1                2       28.57             2        28.57
2                2       28.57             4        57.14
3                1       14.29             5        71.43
4                1       14.29             6        85.71
5                1       14.29             7       100.00

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 20:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550775#M16916</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-12T20:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: sas does not recognize the comma between observation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550811#M16919</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/246838"&gt;@vijay24&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a variable with categorical observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;eg&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id eth&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; 1,2,3&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; 2,5&lt;/P&gt;
&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp;4&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and so on.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data is present in a csv&amp;nbsp;format file. When i import the data, SAS does not recognize the comma between the observations. My proc freq appears something like this:&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In a CSV file if values separated by commas are supposed to appear as a single value then the file should have the text appearing as "1,2,3" , within quotes to indicate such. If your text file does not have the quotes then it is not complying with the rules for a CSV. Or possible you want them as a single value when you shouldn't. Generally such as you show is very difficult to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And depending on how you read the data there could be other issues if the values did appear that way. If you use proc import to read a file then SAS makes guesses as to column types and lengths and by default does not look at very many rows. Potentially if the first 20 rows did not have any of the grouped values then SAS may have set the field to be numeric and then such values would be considered invalid data as 1,2,3 is not a valid numeric value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 23:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-does-not-recognize-the-comma-between-observation/m-p/550811#M16919</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-12T23:05:56Z</dc:date>
    </item>
  </channel>
</rss>

