<?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: defining multiple variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570523#M160884</link>
    <description>&lt;P&gt;Just rename the variable name .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
	input enrolid1 date1 : mmddyy10. (x1 x2 x3 x4) ($);
	format date1 mmddyy10.;
	datalines;
4 5/5/2009    y n y n
4 5/5/2009    y y y y
;
run; 

data wide;
input variable $ def $;
datalines;
x1   head
x2   neck
x3   stomach
x4    colon
;
run; 

proc sql noprint;
select catx('=',variable,def) into : list separated by ' '
 from wide;
quit;
proc datasets library=work nolist nodetails;
modify long;
rename &amp;amp;list ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Jul 2019 12:45:10 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-07-02T12:45:10Z</dc:date>
    <item>
      <title>defining multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570511#M160880</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
	input enrolid1 date1 : mmddyy10. x1 x2 x3 x4;
	format date1 mmddyy10.;
	datalines;
4 5/5/2009    y n y n
4 5/5/2009    y y y y;
run; 

data wide;
input variable def
datalines;
x1   head
x2   neck
x3   stomach
x4    colon;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have the following datasets, I am trying to define each of the xs in data long from data wide and looking for the following output :&amp;nbsp;&lt;/P&gt;&lt;P&gt;enrolid1 date1 head neck stomach colon&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;4 &lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;5/5/2009 y n y n &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;4 5/5/2009 y y y y&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 12:11:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570511#M160880</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2019-07-02T12:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: defining multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570523#M160884</link>
      <description>&lt;P&gt;Just rename the variable name .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
	input enrolid1 date1 : mmddyy10. (x1 x2 x3 x4) ($);
	format date1 mmddyy10.;
	datalines;
4 5/5/2009    y n y n
4 5/5/2009    y y y y
;
run; 

data wide;
input variable $ def $;
datalines;
x1   head
x2   neck
x3   stomach
x4    colon
;
run; 

proc sql noprint;
select catx('=',variable,def) into : list separated by ' '
 from wide;
quit;
proc datasets library=work nolist nodetails;
modify long;
rename &amp;amp;list ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 12:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570523#M160884</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-02T12:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: defining multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570525#M160886</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/72105"&gt;@lillymaginta&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question isn't making a clean sense of a clear logical objective of a look up.&amp;nbsp; But,FWIW&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data wide;
input variable $ def $;
datalines;
x1   head
x2   neck
x3   stomach
x4    colon
;
run;

proc transpose data=wide out=t(drop=_name_);
var variable;
id def;
run;

data want;
set long;
if _n_=1 then set t;
array j head--colon;
array k x:;
do i=1 to dim(j);
j(i)=k(i);/*I am not sure if this is what you want, the look up flow should be rather neat */
end;
drop i x:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 12:47:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570525#M160886</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-02T12:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: defining multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570553#M160899</link>
      <description>Thank you, I was trying to replace the variables with the correct names as Ksharp suggested</description>
      <pubDate>Tue, 02 Jul 2019 13:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/defining-multiple-variables/m-p/570553#M160899</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2019-07-02T13:35:46Z</dc:date>
    </item>
  </channel>
</rss>

