<?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: proc append help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48051#M12960</link>
    <description>The following should do the trick.  I made some minor assumptions about your data.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data tags(keep=idnum tag val);&lt;BR /&gt;
infile datalines dlm=',';&lt;BR /&gt;
input idnum tag $ num_val txt_val $;&lt;BR /&gt;
length val $10;&lt;BR /&gt;
if num_val ne ' ' then val=input(num_val,best.);&lt;BR /&gt;
else val = txt_val;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1,tag1,1,-&lt;BR /&gt;
1,tag2,1,-&lt;BR /&gt;
1,tag3,2,-&lt;BR /&gt;
2,tag1,3,-&lt;BR /&gt;
2,tag2,2,-&lt;BR /&gt;
2,tag3,1,-&lt;BR /&gt;
2,tag4,.,txt&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=tags&lt;BR /&gt;
               out=ttags(drop=_name_);&lt;BR /&gt;
   by idnum;&lt;BR /&gt;
   id tag;&lt;BR /&gt;
   var val;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Wed, 14 Jul 2010 00:56:51 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2010-07-14T00:56:51Z</dc:date>
    <item>
      <title>proc transpose help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48050#M12959</link>
      <description>hi sas experts,&lt;BR /&gt;
&lt;BR /&gt;
let's say i have this table&lt;BR /&gt;
&lt;BR /&gt;
id,tag,num_val,txt_val&lt;BR /&gt;
1,tag1,1,-&lt;BR /&gt;
1,tag2,1,-&lt;BR /&gt;
1,tag3,2,-&lt;BR /&gt;
2,tag1,3,-&lt;BR /&gt;
2,tag2,2,-&lt;BR /&gt;
2,tag3,1,-&lt;BR /&gt;
2,tag4,,txt&lt;BR /&gt;
&lt;BR /&gt;
i want to transpose this and have a result like these&lt;BR /&gt;
&lt;BR /&gt;
id,tag1,tag2,tag3,tag4&lt;BR /&gt;
1,1,1,2,&lt;BR /&gt;
2,3,2,1,txt&lt;BR /&gt;
&lt;BR /&gt;
the value of tag&lt;N&gt; depends on which of num_value and txt_value is not missing on the first dataset&lt;BR /&gt;
&lt;BR /&gt;
hope for your inputs&lt;BR /&gt;
&lt;BR /&gt;
thanks,&lt;BR /&gt;
milton

Message was edited by: milts&lt;/N&gt;</description>
      <pubDate>Tue, 13 Jul 2010 09:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48050#M12959</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2010-07-13T09:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc append help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48051#M12960</link>
      <description>The following should do the trick.  I made some minor assumptions about your data.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data tags(keep=idnum tag val);&lt;BR /&gt;
infile datalines dlm=',';&lt;BR /&gt;
input idnum tag $ num_val txt_val $;&lt;BR /&gt;
length val $10;&lt;BR /&gt;
if num_val ne ' ' then val=input(num_val,best.);&lt;BR /&gt;
else val = txt_val;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1,tag1,1,-&lt;BR /&gt;
1,tag2,1,-&lt;BR /&gt;
1,tag3,2,-&lt;BR /&gt;
2,tag1,3,-&lt;BR /&gt;
2,tag2,2,-&lt;BR /&gt;
2,tag3,1,-&lt;BR /&gt;
2,tag4,.,txt&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=tags&lt;BR /&gt;
               out=ttags(drop=_name_);&lt;BR /&gt;
   by idnum;&lt;BR /&gt;
   id tag;&lt;BR /&gt;
   var val;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 14 Jul 2010 00:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48051#M12960</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-07-14T00:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc append help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48052#M12961</link>
      <description>Thanks for your inputs Art!&lt;BR /&gt;
&lt;BR /&gt;
btw sorry for the misleading subject. it should be proc transpose</description>
      <pubDate>Wed, 14 Jul 2010 06:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-help/m-p/48052#M12961</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2010-07-14T06:44:30Z</dc:date>
    </item>
  </channel>
</rss>

