<?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: Turn column name into text in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Turn-column-name-into-text/m-p/721687#M223707</link>
    <description>VNAME() function or VLABEL() for the label.&lt;BR /&gt;&lt;BR /&gt;output_column = vname(v(i));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would also recommend a quick check - check if the minimum value is less than 0. If not, you don't need to check that row at all.</description>
    <pubDate>Wed, 24 Feb 2021 21:25:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-02-24T21:25:47Z</dc:date>
    <item>
      <title>Turn column name into text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Turn-column-name-into-text/m-p/721686#M223706</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;------ good code----&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
array v[*] var:;
if min(of v[*])&amp;lt;0 then do;
	do i=1 to dim(v);
		if v[i]&amp;lt;0 then do;
			output_name=row;
			output_column = vname(v[i]);
			output;
		end;
	end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;------&lt;/P&gt;
&lt;P&gt;For each negative value in my table, I need to keep track of the name of row ("name") and the name of column and the value itself.&lt;/P&gt;
&lt;P&gt;My output data should look like that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output_row | output_column | value&lt;BR /&gt;loc1 | var2 | -3&lt;BR /&gt;loc2 | var2 | -4&lt;BR /&gt;loc2 | var3 | -55&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone please help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; input row $ var1 var2 var3;
datalines;
loc1 2 -3 9
loc2 4 -4 -55
loc3 4 5 6
run;

*I think it can be the approach;
data want; set have;
array v[*] var:;
do i=1 to dim(v);
	if v&amp;lt;0 then do;
		output_name=row;
		output_column= turn column name to text;
		output;
	end;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 23:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Turn-column-name-into-text/m-p/721686#M223706</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2021-02-24T23:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Turn column name into text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Turn-column-name-into-text/m-p/721687#M223707</link>
      <description>VNAME() function or VLABEL() for the label.&lt;BR /&gt;&lt;BR /&gt;output_column = vname(v(i));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would also recommend a quick check - check if the minimum value is less than 0. If not, you don't need to check that row at all.</description>
      <pubDate>Wed, 24 Feb 2021 21:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Turn-column-name-into-text/m-p/721687#M223707</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-24T21:25:47Z</dc:date>
    </item>
  </channel>
</rss>

