<?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 Format issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587427#M167783</link>
    <description>&lt;P&gt;After executing the code below,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table dis_entity_id as select distinct ENTITY_ID  format=$ENTIT. from INSURANCE_CONTRACT;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got Output as ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;DKV Seguros&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DKV Belgien&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;NULL&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;RGO Schadn/Unfall&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;RGO Hestia&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want the Output as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;DKV Seguros/DKV Belgien/NULL/RGO Schadn Unfall/RGO Hestia&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so I ran the code below&amp;nbsp;to get the desired output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data reqd_vars (drop=ENTITY_ID);
	set dis_entity_id end=last_record;
	by ENTITY_ID;
/*	format ENTY_NM $ENTIT.;*/
	length ENTY_NM $50;
	retain ENTY_NM;

	if first.ENTITY_ID then
		ENTY_NM=catx('/',ENTY_NM,ENTITY_ID);

	if last_record then
		output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the Output which I got is &lt;EM&gt;54009/54010/580001/58001/60011 &lt;/EM&gt;instead of &lt;EM&gt;DKV Seguros/DKV Belgien/NULL/RGO Schadn Unfall/RGO Hestia. &lt;/EM&gt;May I know why the Format is not applied in the bew variable ENTY_NM?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 06:05:24 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2019-09-10T06:05:24Z</dc:date>
    <item>
      <title>Format issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587427#M167783</link>
      <description>&lt;P&gt;After executing the code below,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table dis_entity_id as select distinct ENTITY_ID  format=$ENTIT. from INSURANCE_CONTRACT;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got Output as ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;DKV Seguros&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DKV Belgien&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;NULL&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;RGO Schadn/Unfall&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;RGO Hestia&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want the Output as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;DKV Seguros/DKV Belgien/NULL/RGO Schadn Unfall/RGO Hestia&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so I ran the code below&amp;nbsp;to get the desired output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data reqd_vars (drop=ENTITY_ID);
	set dis_entity_id end=last_record;
	by ENTITY_ID;
/*	format ENTY_NM $ENTIT.;*/
	length ENTY_NM $50;
	retain ENTY_NM;

	if first.ENTITY_ID then
		ENTY_NM=catx('/',ENTY_NM,ENTITY_ID);

	if last_record then
		output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the Output which I got is &lt;EM&gt;54009/54010/580001/58001/60011 &lt;/EM&gt;instead of &lt;EM&gt;DKV Seguros/DKV Belgien/NULL/RGO Schadn Unfall/RGO Hestia. &lt;/EM&gt;May I know why the Format is not applied in the bew variable ENTY_NM?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 06:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587427#M167783</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-10T06:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Format issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587429#M167785</link>
      <description>&lt;P&gt;Formats only apply when you print or view SAS variables, not when you manipulate the actual stored values with CATX and so on. If you want the formatted values actually stored in your data use the PUT function to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ENTY_NM=catx('/',put(ENTY_NM, $ENTIT.),ENTITY_ID);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit: judging by your SQL example the format should be applied to ENTITY_ID not ENTY_NM:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ENTY_NM=catx('/',ENTY_NM,put(ENTITY_ID, $ENTIT.));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 06:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587429#M167785</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-10T06:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Format issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587430#M167786</link>
      <description>I just wanted to inform you that both entity_id and entity_nm are character&lt;BR /&gt;variables.&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Sep 2019 06:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-issue/m-p/587430#M167786</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-10T06:28:44Z</dc:date>
    </item>
  </channel>
</rss>

