<?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: simple concatenation in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709065#M26675</link>
    <description>&lt;P&gt;Note that you type 'jobacategory' instead of 'jobcategory'. If jobcategory it is strange that the code still outputs only 'FA'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data staff;
  length jobcategory $3 joblevel $1 ;
  jobcategory='FA';
  joblevel='4';
  jobcategory=jobcategory||joblevel;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Jan 2021 15:10:42 GMT</pubDate>
    <dc:creator>anming</dc:creator>
    <dc:date>2021-01-02T15:10:42Z</dc:date>
    <item>
      <title>simple concatenation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709039#M26664</link>
      <description>&lt;PRE&gt;data staff;&lt;BR /&gt;jobcategory='FA';&lt;BR /&gt;joblevel='4';&lt;BR /&gt;jobacategory=jobcategory||joblevel;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;for the code to concatenate two strings jobcategory only outputs 'FA'. if change the code to jobcategory1=jobcategory||joblevel, jobcategory1 will be assigned to 'FA4'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why can not assign a new value to the variable of jobcategory through the code above?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jan 2021 04:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709039#M26664</guid>
      <dc:creator>anming</dc:creator>
      <dc:date>2021-01-02T04:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: simple concatenation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709044#M26667</link>
      <description>&lt;P&gt;Because the first reference to jobcategory is the assignment of the two-character literal value "FA", SAS assigned a length of $2 to the variable.&amp;nbsp; So while the concatenation operator was honored by SAS, it only could fit the first two characters of the result into the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the new variable jobcategory1 will be assigned a length of $3, since that is the sum of $2 (for jobcategory) and $1 (for joblevel).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, if instead of&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;jobcategory1=jobcategory||joblevel;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you had used one of the concatenation functions,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;jobcategory1=cat(jobcategory,joblevel);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you would get the same resulting values, but SAS would assign a length of $200 to jobcategory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jan 2021 05:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709044#M26667</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-01-02T05:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: simple concatenation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709049#M26669</link>
      <description>&lt;P&gt;Don't force SAS to guess how you want your variables defined, especially character variables. Tell it explicitly what length to use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data staff;
  length jobcategory $3 joblevel $1 ;
  jobcategory='FA';
  joblevel='4';
  jobacategory=jobcategory||joblevel;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Jan 2021 06:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709049#M26669</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-02T06:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: simple concatenation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709065#M26675</link>
      <description>&lt;P&gt;Note that you type 'jobacategory' instead of 'jobcategory'. If jobcategory it is strange that the code still outputs only 'FA'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data staff;
  length jobcategory $3 joblevel $1 ;
  jobcategory='FA';
  joblevel='4';
  jobcategory=jobcategory||joblevel;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jan 2021 15:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/simple-concatenation/m-p/709065#M26675</guid>
      <dc:creator>anming</dc:creator>
      <dc:date>2021-01-02T15:10:42Z</dc:date>
    </item>
  </channel>
</rss>

