<?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 do you separate character variables, numeric variables and mixed these variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329126#M73582</link>
    <description>&lt;P&gt;What do you mean by "separate".?&amp;nbsp; Your program, (after correction of spelling in datalines statement) &amp;nbsp;as it stands, reads three numeric vars, and ignores the 4th data item in each line of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read the 4th field, you need a 4th varname in the input statement, along with an input &amp;nbsp;format to tell sas it is a character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;input a b c&amp;nbsp;&amp;nbsp;&amp;nbsp; d $1. ;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2017 15:34:22 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2017-02-01T15:34:22Z</dc:date>
    <item>
      <title>how do you separate character variables, numeric variables and mixed these variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329115#M73580</link>
      <description>&lt;P&gt;data temp1;&lt;/P&gt;&lt;P&gt;input a b c d$;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 1 1 x&lt;/P&gt;&lt;P&gt;1 1 1 y&lt;/P&gt;&lt;P&gt;1 1 1 z&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329115#M73580</guid>
      <dc:creator>Irfanmohammed</dc:creator>
      <dc:date>2017-02-01T15:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: how do you separate character variables, numeric variables and mixed these variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329122#M73581</link>
      <description>&lt;P&gt;I am sorry, your question is not clear. &amp;nbsp;Also note your test data is incorrect (typo in datalines, column d is never read in). &amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are defaults in SAS, as you have not supplied $ in the input line, then the data defaults to numeric, although the final column would not as it is character.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329122#M73581</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-01T15:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: how do you separate character variables, numeric variables and mixed these variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329126#M73582</link>
      <description>&lt;P&gt;What do you mean by "separate".?&amp;nbsp; Your program, (after correction of spelling in datalines statement) &amp;nbsp;as it stands, reads three numeric vars, and ignores the 4th data item in each line of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read the 4th field, you need a 4th varname in the input statement, along with an input &amp;nbsp;format to tell sas it is a character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;input a b c&amp;nbsp;&amp;nbsp;&amp;nbsp; d $1. ;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329126#M73582</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-01T15:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: how do you separate character variables, numeric variables and mixed these variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329128#M73583</link>
      <description>&lt;P&gt;Please be a bit more specific on your question. What do you mean my "separate"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean make a varaible numeric or character the way the variable is created will set whether it is numeric or character. By default most variables will be numeric. SAS does not have &lt;STRONG&gt;any&lt;/STRONG&gt; "mixed" type. A variable is either numeric or character. If you want to see the character values the variable must be character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a simple example such as you provide using $ after the variable name will tell SAS to read the last column as character. The default when done this way will hold a maximum of 8 characters. If you specify an INFORMAT or LENGTH&amp;nbsp;statement for the varaible before use you can set the length longer to hold a longer value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data temp1;&lt;/P&gt;
&lt;P&gt;input a b c letter $;&lt;/P&gt;
&lt;P&gt;datallines;&lt;/P&gt;
&lt;P&gt;1 1 1 x&lt;/P&gt;
&lt;P&gt;1 1 1 y&lt;/P&gt;
&lt;P&gt;1 1 1 z&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data temp1;&lt;/P&gt;
&lt;P&gt;Length letter $ 25; /*&amp;lt;= set maximumn number of characters a variable will hold to 25*/&lt;/P&gt;
&lt;P&gt;input a b c letter $;&lt;/P&gt;
&lt;P&gt;datalines; /*&amp;lt;= corrected spelling*/&lt;/P&gt;
&lt;P&gt;1 1 1 x&lt;/P&gt;
&lt;P&gt;1 1 1 y&lt;/P&gt;
&lt;P&gt;1 1 1 z&lt;/P&gt;
&lt;P&gt;2 2 2 Amuchlongerstring&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;data temp1;&lt;/P&gt;
&lt;P&gt;informat letter $25. ; /*&amp;lt;=read variable using 25 characters*/&lt;/P&gt;
&lt;P&gt;input a b c letter $;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;1 1 1 x&lt;/P&gt;
&lt;P&gt;1 1 1 y&lt;/P&gt;
&lt;P&gt;1 1 1 z&lt;/P&gt;
&lt;P&gt;2 2 2 Amuchlongerstring&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Also you can enclose a value in single or double quotes in an assignment statement&lt;/P&gt;
&lt;P&gt;data temp1;&lt;/P&gt;
&lt;P&gt;informat letter $25. ; /*&amp;lt;=read variable using 25 characters*/&lt;/P&gt;
&lt;P&gt;input a b c letter $;&lt;/P&gt;
&lt;P&gt;anothervar = 'This is a different string value'; /*&amp;lt;= note that when using this approach without a Length statement the length will the that of the first value encountered in the code in this case 32*/&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;1 1 1 x&lt;/P&gt;
&lt;P&gt;1 1 1 y&lt;/P&gt;
&lt;P&gt;1 1 1 z&lt;/P&gt;
&lt;P&gt;2 2 2 Amuchlongerstring&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-separate-character-variables-numeric-variables-and/m-p/329128#M73583</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-01T15:39:32Z</dc:date>
    </item>
  </channel>
</rss>

