<?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: using column values to become variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243113#M45208</link>
    <description>&lt;P&gt;Check MERGE skill, me , Matt and Arthur.T proposed :&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dsd;
informat id_key 1. process $1. process_date mmddyy10.;
format id_key 1. process $1. process_date mmddyy10.;
input ID_key    process$    process_date;
cards;
1,x,01-01-15
1,y,02-01-15
2,x,03-01-15
;
run;
proc sql;
select distinct catt('have(where=(id_key=',id_key,' and process="',process,'") rename=(process_date=',process,'_process_date))') into : merge separated by ' '
 from have;
quit;
data want;
 merge &amp;amp;merge;
 by id_key ;
 drop process;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Jan 2016 02:40:50 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-01-13T02:40:50Z</dc:date>
    <item>
      <title>using column values to become variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/242860#M45117</link>
      <description>&lt;P&gt;Hi, have the following data set which captures key process dates by an ID key....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID_key&lt;/TD&gt;&lt;TD&gt;process&lt;/TD&gt;&lt;TD&gt;process_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;01-01-15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;02-01-15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;03-01-15&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and want to convert it to the below, where the process value becomes the name of the process date...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID_key&lt;/TD&gt;&lt;TD&gt;x_process_date&lt;/TD&gt;&lt;TD&gt;y_process_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01-01-15&lt;/TD&gt;&lt;TD&gt;02-01-15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;03-01-15&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope that made sense...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what would be the best way to do this ??&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 04:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/242860#M45117</guid>
      <dc:creator>devindaj</dc:creator>
      <dc:date>2016-01-12T04:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: using column values to become variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/242927#M45133</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;infile cards dsd;&lt;BR /&gt;informat id_key 1. process $1. process_date mmddyy10.;&lt;BR /&gt;format id_key 1. process $1. process_date mmddyy10.;&lt;BR /&gt;input ID_key&amp;nbsp;&amp;nbsp; &amp;nbsp;process$&amp;nbsp;&amp;nbsp; &amp;nbsp;process_date;&lt;BR /&gt;cards;&lt;BR /&gt;1,x,01-01-15&lt;BR /&gt;1,y,02-01-15&lt;BR /&gt;2,x,03-01-15&lt;BR /&gt;;run;&lt;BR /&gt;&lt;BR /&gt;proc transpose data=have out=tran_have(drop=process _name_)prefix=Process_Date_;by id_key process;id process;&lt;BR /&gt;&lt;BR /&gt;data want(keep=id_key X_Process_date Y_Process_Date);&lt;BR /&gt;set tran_have(rename=process_date_y=Y_Process_date);&lt;BR /&gt;by id_key;&lt;BR /&gt;retain X_Process_date;&lt;BR /&gt;if first.id_key then X_Process_date = Process_Date_X;&lt;BR /&gt;if last.id_key;&lt;BR /&gt;format X_Process_Date mmddyy10.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 14:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/242927#M45133</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2016-01-12T14:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: using column values to become variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243074#M45192</link>
      <description>&lt;P&gt;By using &lt;FONT face="courier new,courier"&gt;suffix&lt;/FONT&gt; option instead of &lt;FONT face="courier new,courier"&gt;prefix&lt;/FONT&gt; you can skip the last datastep.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 21:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243074#M45192</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2016-01-12T21:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: using column values to become variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243113#M45208</link>
      <description>&lt;P&gt;Check MERGE skill, me , Matt and Arthur.T proposed :&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dsd;
informat id_key 1. process $1. process_date mmddyy10.;
format id_key 1. process $1. process_date mmddyy10.;
input ID_key    process$    process_date;
cards;
1,x,01-01-15
1,y,02-01-15
2,x,03-01-15
;
run;
proc sql;
select distinct catt('have(where=(id_key=',id_key,' and process="',process,'") rename=(process_date=',process,'_process_date))') into : merge separated by ' '
 from have;
quit;
data want;
 merge &amp;amp;merge;
 by id_key ;
 drop process;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2016 02:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243113#M45208</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-13T02:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: using column values to become variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243115#M45209</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dsd;
informat id_key 1. process $1. process_date mmddyy10.;
format id_key 1. process $1. process_date mmddyy10.;
input ID_key  x  process$    process_date;
cards;
1,1,x,01-01-15
1,2,y,02-01-15
2,1,x,03-01-15
;run;

proc transpose data=have out=tran_have(drop=_name_)  suffix=_Process_Date;
by id_key ;
id process;
var process_date ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 02:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-column-values-to-become-variable-names/m-p/243115#M45209</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-13T02:52:27Z</dc:date>
    </item>
  </channel>
</rss>

