<?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: Convert all the columns into individual macros based the column names, different ways !! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587282#M167728</link>
    <description>&lt;P&gt;Going with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; neat suggestion of proc transpose&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input A	B	C	AB	BC	CA	ABC;
cards;
104	112	158	40	46	6	58
;

proc transpose data=have(obs=0) out=temp;
var _all_;
run;
data _null_;
set temp;
call symputx(_name_,_name_,'g');
run;

%put _global_;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Sep 2019 15:34:31 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-09-09T15:34:31Z</dc:date>
    <item>
      <title>Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587261#M167717</link>
      <description>&lt;P&gt;Hi all ,&lt;/P&gt;&lt;P&gt;I have a data set having values as described below:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;A&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;B&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;AB&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;BC&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;CA&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;ABC&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;104&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;112&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;158&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;40&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;46&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;6&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;58&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;I want to convert all the columns in to individual sas macro variables based on the current column names they have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rather than writing a proc SQL statement, is there any other shorter way to do achieve that? Kindly share your thoughts.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587261#M167717</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2019-09-09T15:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587269#M167719</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109034"&gt;@sahoositaram555&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all ,&lt;/P&gt;
&lt;P&gt;I have a data set having values as described below:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;B&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;AB&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;BC&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;CA&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;ABC&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;104&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;112&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;158&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;40&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;46&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;58&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;I want to convert all the columns in to individual sas macros based on the current column names they have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rather than writing a proc SQL statement, is there any other shorter way to do achieve that? Kindly share your hought&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's hard to imagine something quicker than SQL, if you must do this (although since you ask for a shorter way, it may be that you don't need macro variables at all here, as in general you don't want data to be stored in macro variables; there's nothing easier than NOT turning this into macro variables; but you'd have to explain more for us to know).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Terminology note so we all use the same language: you are talking about &lt;EM&gt;macro variables&lt;/EM&gt; and not macros.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587269#M167719</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-09T15:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587275#M167723</link>
      <description>You can use a data step with an array. VNAME() will get the variable name.  It's more dynamic than SQL because you don't need to list all the names. &lt;BR /&gt;&lt;BR /&gt;Or transpose it to a long format and then use the variable names.</description>
      <pubDate>Mon, 09 Sep 2019 15:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587275#M167723</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-09T15:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587278#M167725</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was a mistake from my end. I have modified my query as suggested.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587278#M167725</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2019-09-09T15:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587282#M167728</link>
      <description>&lt;P&gt;Going with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; neat suggestion of proc transpose&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input A	B	C	AB	BC	CA	ABC;
cards;
104	112	158	40	46	6	58
;

proc transpose data=have(obs=0) out=temp;
var _all_;
run;
data _null_;
set temp;
call symputx(_name_,_name_,'g');
run;

%put _global_;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587282#M167728</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-09T15:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587285#M167731</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; Very smart thinking coz proc transpose method is a safe bet that handles combination of char and num/both or none as opposed to array where tyhe WHAT-IF check can complicate if there is only one that exist in some dataset and both exist in some other. Kudos! Now I believe you are moving to coffee from tea lol&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587285#M167731</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-09T15:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587288#M167732</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;: I think what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;had in mind was not using "&lt;FONT face="courier new,courier"&gt;(obs=0)&lt;/FONT&gt;" in PROC TRANSPOSE and &lt;FONT face="courier new,courier"&gt;col1&lt;/FONT&gt; rather than &lt;FONT face="courier new,courier"&gt;_name_&lt;/FONT&gt; as the second argument of CALL SYMPUTX.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587288#M167732</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-09-09T15:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587292#M167734</link>
      <description>&lt;P&gt;Hmm oh well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; you are right&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 16:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587292#M167734</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-09T16:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all the columns into individual macros based the column names, different ways !!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587484#M167809</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A	B	C	AB	BC	CA	ABC;
cards;
104	112	158	40	46	6	58
;
data _null_;
 set have;
 array x{*} _all_;
do i=1 to dim(x);
 call symputx(vname(x{i}),x{i});
end;
run;

%put _user_ ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:22:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-the-columns-into-individual-macros-based-the-column/m-p/587484#M167809</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-10T12:22:54Z</dc:date>
    </item>
  </channel>
</rss>

