<?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: Can i put legend/label in my proc sql table? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562494#M157578</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274500"&gt;@Kayla_Tan222&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS Format is for printing but doesn't change the internal value. So if you just apply the format then your data will still be ordered by the internal values but if you look at the data then you'll see the formatted values.&lt;/P&gt;</description>
    <pubDate>Thu, 30 May 2019 08:34:31 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-05-30T08:34:31Z</dc:date>
    <item>
      <title>Can i put legend/label in my proc sql table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562478#M157566</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if it possible to put legend for my table created using proc sql&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my code&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SMCD_PD_FY_10DY_201812 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; put(zmajrsk,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$class.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class, dev10yr_fy,sum(zclmpd) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; zclmpd&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; polaclm.pola_clm_agg_201812&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;WHERE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; accyr_fy=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2019&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;GROUP&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attach a screenshot of my proc sql table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want o label the class beside my table, For Ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1=VEH&lt;/P&gt;&lt;P&gt;2=FIR&lt;/P&gt;&lt;P&gt;3=LIA&lt;/P&gt;&lt;P&gt;4=ENG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can I put a legend statement inside the code? or my idea is wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 06:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562478#M157566</guid>
      <dc:creator>Kayla_Tan222</dc:creator>
      <dc:date>2019-05-30T06:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can i put legend/label in my proc sql table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562480#M157567</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274500"&gt;@Kayla_Tan222&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create a format (Proc Format) and then assign this format permanently to the variable when you create it in the SQL Select Clause.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put(zmajrsk,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$class.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;class format=myformat.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also define a label for your variable like:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put(zmajrsk,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$class.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;class label='1=VEH,&amp;nbsp;2=FIR,&amp;nbsp;3=LIA,&amp;nbsp;4=ENG'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 06:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562480#M157567</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-30T06:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can i put legend/label in my proc sql table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562481#M157568</link>
      <description>&lt;P&gt;I think what you want to do is this. Roll out your own numeric format for the class variable and assign it in the select clause of PROC SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format lib=work;
   value class 1="VEH"
               2="FIR"
               3="LIA"
               4="ENG";
run;

proc sql;
   create table smcd_pd_fy_10dy_201812 as
      select zmajrsk as class format=class., 
             dev10yr_fy,
             sum(zclmpd) as zclmpd
      from polaclm.pola_clm_agg_201812
      where accyr_fy=2019
      group by class,2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 May 2019 06:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562481#M157568</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-30T06:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can i put legend/label in my proc sql table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562490#M157574</link>
      <description>&lt;P&gt;Hi draycut, my full code is actually this. I put the number for VEH,FIR,...,ENG because I want them to be ordered when shown in the table. However, I want to show the VEH,FIR...,..ENG in my table as well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;FORMAT&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; $ class&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'VEH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'1'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'FIR'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'GMS'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'3'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'BON'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'3'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'HUL'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'3'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'PAC'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'4'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'TEL'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'5'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'WWC'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'5'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'LIA'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'6'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'CGO'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'7'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'ENG'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'8'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SMCD_PD_FY_10DY_201812 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; put(zmajrsk,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$class.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class, dev10yr_fy,sum(zclmpd) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; zclmpd&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; polaclm.pola_clm_agg_201812&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;WHERE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; accyr_fy=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2019&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;GROUP&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 08:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562490#M157574</guid>
      <dc:creator>Kayla_Tan222</dc:creator>
      <dc:date>2019-05-30T08:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can i put legend/label in my proc sql table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562494#M157578</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274500"&gt;@Kayla_Tan222&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS Format is for printing but doesn't change the internal value. So if you just apply the format then your data will still be ordered by the internal values but if you look at the data then you'll see the formatted values.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 08:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-i-put-legend-label-in-my-proc-sql-table/m-p/562494#M157578</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-30T08:34:31Z</dc:date>
    </item>
  </channel>
</rss>

