<?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: String Function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19245#M3889</link>
    <description>Investigate using the SCAN function (DATA step, SAS variable assignment) and also the PROC TRANSPOSE procedure.  The SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  has SAS-hosted documentation for this topic area.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Thu, 19 Nov 2009 00:24:06 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-11-19T00:24:06Z</dc:date>
    <item>
      <title>String Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19244#M3888</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
   I have a dataset with two obs and one varibale. The variable name is A and the values are "USA SAS" &amp;amp; "EARTH WORLD". I need to create a output datset like below.&lt;BR /&gt;
&lt;BR /&gt;
INPUT:&lt;BR /&gt;
&lt;BR /&gt;
A&lt;BR /&gt;
---&lt;BR /&gt;
USA SAS&lt;BR /&gt;
EARTH WORLD&lt;BR /&gt;
&lt;BR /&gt;
OUTPUT :&lt;BR /&gt;
USA     EARTH&lt;BR /&gt;
-----       ----------&lt;BR /&gt;
SAS        .&lt;BR /&gt;
.           WORLD  &lt;BR /&gt;
&lt;BR /&gt;
The first part of my input variable A should go to output varible and the second part of the input variable will be VALUE of the output variable, Could you please let me know how to do this?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 18 Nov 2009 23:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19244#M3888</guid>
      <dc:creator>DPraba79</dc:creator>
      <dc:date>2009-11-18T23:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: String Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19245#M3889</link>
      <description>Investigate using the SCAN function (DATA step, SAS variable assignment) and also the PROC TRANSPOSE procedure.  The SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  has SAS-hosted documentation for this topic area.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 19 Nov 2009 00:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19245#M3889</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-11-19T00:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: String Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19246#M3890</link>
      <description>Alternatively you can try this.&lt;BR /&gt;
Spaces in sas variable names must be used with caution, so I used a _ instead.&lt;BR /&gt;
You can use a space in the variable label if you want.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data SAMPLE;&lt;BR /&gt;
infile cards truncover;&lt;BR /&gt;
input A $16.;&lt;BR /&gt;
cards;&lt;BR /&gt;
USA SAS&lt;BR /&gt;
EARTH WORLD&lt;BR /&gt;
run; &lt;BR /&gt;
data STEP1;&lt;BR /&gt;
set SAMPLE;&lt;BR /&gt;
length NAME $16;                 * set variable name length;&lt;BR /&gt;
retain NAME;                     * variable name is built across several obs;&lt;BR /&gt;
VALUE=scan(A,2);                 * build values;&lt;BR /&gt;
NAME=catx('_',NAME,scan(A,1));   * build variable name;&lt;BR /&gt;
call symput('varname', NAME);    * save variable name;&lt;BR /&gt;
run;&lt;BR /&gt;
data STEP2;&lt;BR /&gt;
set STEP1 (keep=VALUE rename=(VALUE=&amp;amp;varname)); * use variable name;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 26 Nov 2009 21:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/String-Function/m-p/19246#M3890</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-11-26T21:15:28Z</dc:date>
    </item>
  </channel>
</rss>

