<?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 How do I put first and last name into one variable??? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398432#M278397</link>
    <description>&lt;P&gt;data statedata;&lt;/P&gt;&lt;P&gt;infile '\\Client\E$\SASData\StateData.txt'&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;delimiter = ' ' ;&lt;/P&gt;&lt;P&gt;input States $ Region $ Manager Visits d z k l m n i o g;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname state '\\Client\E$\Data';&lt;/P&gt;&lt;P&gt;data state.state_final;&lt;/P&gt;&lt;P&gt;set statedata;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=state.state_final;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It runs well/ however, in the first variable (states) there are states like new york and that add an extra space which throws everything off. So how do I in cases where there is spaces between the state names put them together in one in variable 1(states).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please include it in my code. Been stuck on this forever. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2017 02:24:14 GMT</pubDate>
    <dc:creator>jsjoden</dc:creator>
    <dc:date>2017-09-25T02:24:14Z</dc:date>
    <item>
      <title>How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398432#M278397</link>
      <description>&lt;P&gt;data statedata;&lt;/P&gt;&lt;P&gt;infile '\\Client\E$\SASData\StateData.txt'&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;delimiter = ' ' ;&lt;/P&gt;&lt;P&gt;input States $ Region $ Manager Visits d z k l m n i o g;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname state '\\Client\E$\Data';&lt;/P&gt;&lt;P&gt;data state.state_final;&lt;/P&gt;&lt;P&gt;set statedata;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=state.state_final;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It runs well/ however, in the first variable (states) there are states like new york and that add an extra space which throws everything off. So how do I in cases where there is spaces between the state names put them together in one in variable 1(states).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please include it in my code. Been stuck on this forever. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 02:24:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398432#M278397</guid>
      <dc:creator>jsjoden</dc:creator>
      <dc:date>2017-09-25T02:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398433#M278398</link>
      <description>&lt;P&gt;Not sure what your data looks like but I'm guessing you need an INFORMAT&amp;nbsp;modifier for your STATES variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input States : $8. Region $ Manager Visits d z k l m n i o g;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 03:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398433#M278398</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-09-25T03:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398434#M278399</link>
      <description>&lt;P&gt;Since there are spaces in the first variable, how do you know where the second variable starts starts? You need another delimiter.&lt;/P&gt;
&lt;P&gt;Either a comma, or two spaces.&lt;/P&gt;
&lt;P&gt;&amp;amp; allows for single spaces in strings and waits for several spaces before reading&amp;nbsp;the next variable, so may be this help.&lt;/P&gt;
&lt;P&gt;Of course, you could have provided sample data to help us answer properly....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
input STATE &amp;amp;: $16. REGION $ MANAGER VISITS D Z K L M N I O G;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 03:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398434#M278399</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-09-25T03:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398440#M278400</link>
      <description>&lt;P&gt;I attached screenshots of what I am getting. I want the second column for the words like north dakota etc. for the second word dakota to be put in the first colum ( so as one word). Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 05:19:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398440#M278400</guid>
      <dc:creator>jsjoden</dc:creator>
      <dc:date>2017-09-25T05:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398441#M278401</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I attached screenshots of what I am getting. I want the second column for the words like north dakota etc. for the second word dakota to be put in the first colum ( so as one word).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 05:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398441#M278401</guid>
      <dc:creator>jsjoden</dc:creator>
      <dc:date>2017-09-25T05:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398460#M278402</link>
      <description>&lt;P&gt;How about this? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; one;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'\\Client\E$\SASData\StateData.txt'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'|'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; inputstr rinput $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; states region $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;32&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; visits x z y $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; pos &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; inputstr;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;rinput = strip(reverse(inputstr));&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; y = strip(reverse(scan(rinput,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; z = strip(reverse(scan(rinput,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;x&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = strip(reverse(scan(rinput,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; visits = strip(reverse(scan(rinput,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; region = strip(reverse(scan(rinput,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;pos = indexw(strip(inputstr),region);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; states = strip(substr(inputstr,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,pos-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 08:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398460#M278402</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2017-09-25T08:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398553#M278403</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/167331"&gt;@jsjoden&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I attached screenshots of what I am getting. I want the second column for the words like north dakota etc. for the second word dakota to be put in the first colum ( so as one word). Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you must attach screenshots please use an image format like PNG or JPEG. Microsoft documents are security risks and many users here will not open them for that reason or have organization policies and/or security software that blocks them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 14:31:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398553#M278403</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-25T14:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I put first and last name into one variable???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398613#M278404</link>
      <description>&lt;P&gt;Thank YOU!!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 16:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-put-first-and-last-name-into-one-variable/m-p/398613#M278404</guid>
      <dc:creator>jsjoden</dc:creator>
      <dc:date>2017-09-25T16:48:46Z</dc:date>
    </item>
  </channel>
</rss>

