<?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 Adding Data Labels via Reference Table in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644993#M78503</link>
    <description>&lt;P&gt;I have a transposed data set with 51 variables, and need help adding labels to 49 of them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before the transpose, I had a table such as this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Property ID&lt;/TD&gt;&lt;TD&gt;Inspection&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Defect Name&lt;/TD&gt;&lt;TD&gt;Defect Code&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123000&lt;/TD&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;Clogged Drain - Bathroom&lt;/TD&gt;&lt;TD&gt;37593&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123000&lt;/TD&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;Damaged Wall&lt;/TD&gt;&lt;TD&gt;482095&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123000&lt;/TD&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;Mold/Mildew&lt;/TD&gt;&lt;TD&gt;439457&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the transposed table (as example):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Inspection&lt;/TD&gt;&lt;TD&gt;cnt&lt;/TD&gt;&lt;TD&gt;37593&lt;/TD&gt;&lt;TD&gt;482095&lt;/TD&gt;&lt;TD&gt;439457&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;obs_cnt&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are only arbitrary examples, the actual transposed data set has 51 variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Due to the length of the defect name field, I couldn't get the transpose procedure to work on it.&amp;nbsp; It has 49 possible values, with round brackets and hyphens in many cases.&amp;nbsp; Some of these are quite long as well.&amp;nbsp; &amp;nbsp;Therefore, I had to use the defect code which made it far simpler.&amp;nbsp; However, the code field does not tell me much without a label.&amp;nbsp; How can I use a reference table containing the defect code and the corresponding name to add labels to the 49 variables on the transposed table?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 May 2020 13:35:47 GMT</pubDate>
    <dc:creator>RandoDando</dc:creator>
    <dc:date>2020-05-04T13:35:47Z</dc:date>
    <item>
      <title>Adding Data Labels via Reference Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644993#M78503</link>
      <description>&lt;P&gt;I have a transposed data set with 51 variables, and need help adding labels to 49 of them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before the transpose, I had a table such as this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Property ID&lt;/TD&gt;&lt;TD&gt;Inspection&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Defect Name&lt;/TD&gt;&lt;TD&gt;Defect Code&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123000&lt;/TD&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;Clogged Drain - Bathroom&lt;/TD&gt;&lt;TD&gt;37593&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123000&lt;/TD&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;Damaged Wall&lt;/TD&gt;&lt;TD&gt;482095&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123000&lt;/TD&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;Mold/Mildew&lt;/TD&gt;&lt;TD&gt;439457&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the transposed table (as example):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Inspection&lt;/TD&gt;&lt;TD&gt;cnt&lt;/TD&gt;&lt;TD&gt;37593&lt;/TD&gt;&lt;TD&gt;482095&lt;/TD&gt;&lt;TD&gt;439457&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;983750&lt;/TD&gt;&lt;TD&gt;obs_cnt&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are only arbitrary examples, the actual transposed data set has 51 variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Due to the length of the defect name field, I couldn't get the transpose procedure to work on it.&amp;nbsp; It has 49 possible values, with round brackets and hyphens in many cases.&amp;nbsp; Some of these are quite long as well.&amp;nbsp; &amp;nbsp;Therefore, I had to use the defect code which made it far simpler.&amp;nbsp; However, the code field does not tell me much without a label.&amp;nbsp; How can I use a reference table containing the defect code and the corresponding name to add labels to the 49 variables on the transposed table?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 13:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644993#M78503</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2020-05-04T13:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Data Labels via Reference Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644996#M78504</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What that code answer your question?&lt;/P&gt;
&lt;P&gt;The IDLABEL statement c&lt;SPAN&gt;reates labels for the transposed variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=",";
	input Property_ID $ Inspection 	Defect_Name:$50. Defect_Code Count;
	datalines;
AB123000,983750,Clogged Drain - Bathroom,37593,2
AB123000,983750,Damaged Wall,482095,3
AB123000,983750,Mold/Mildew,439457,1
;
run;

proc transpose data=have out=want (drop=_:);
	var count;
	id Defect_Code;
	idlabel Defect_Name;
	by inspection;
run;

proc print data=want;
	title "Without labels";
run;

proc print data=want label;
	title "With labels";
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-05-04 à 15.40.58.png" style="width: 465px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39035iB3971D319ECEA9F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2020-05-04 à 15.40.58.png" alt="Capture d’écran 2020-05-04 à 15.40.58.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 13:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644996#M78504</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-04T13:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Data Labels via Reference Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644999#M78505</link>
      <description>That worked. Hooray for simple solutions! Thanks</description>
      <pubDate>Mon, 04 May 2020 13:45:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/644999#M78505</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2020-05-04T13:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Data Labels via Reference Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/645007#M78507</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt; !</description>
      <pubDate>Mon, 04 May 2020 14:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/645007#M78507</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-04T14:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Data Labels via Reference Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/645009#M78508</link>
      <description>&lt;P&gt;If you want a report that people read then it may be even easier:&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=have;
   class  Inspection    Defect_Name/missing;
   freq  Count;
   table inspection,
         defect_name=''*n=''
         /misstext=' '
   ;
run;&lt;/PRE&gt;
&lt;P&gt;data in the wide format is often harder to work with and, as shown above, reports can often do the "make it wide" as needed.&lt;/P&gt;
&lt;P&gt;Proc Report with the defect_name as an across variable would also work.&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 14:53:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-Data-Labels-via-Reference-Table/m-p/645009#M78508</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-04T14:53:16Z</dc:date>
    </item>
  </channel>
</rss>

