<?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: Changing length of char variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795244#M255049</link>
    <description>&lt;P&gt;Thank you for the example!&lt;/P&gt;</description>
    <pubDate>Wed, 09 Feb 2022 17:35:24 GMT</pubDate>
    <dc:creator>LMSSAS</dc:creator>
    <dc:date>2022-02-09T17:35:24Z</dc:date>
    <item>
      <title>Changing length of char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795231#M255042</link>
      <description>&lt;P&gt;example of output is above my code: I want the column CHECK_AHIP to allow enough char length for "Ready To Train" to NOT get truncated. I have tried format=$25. in my data step and get the below error. I have also tried Format&amp;nbsp;CHECK_AHIP $25.; but it does not change anything in the output. Can someone suggest a solution please?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;99 format=$25.;&lt;BR /&gt;____&lt;BR /&gt;386&lt;BR /&gt;200&lt;BR /&gt;ERROR 386-185: Expecting an arithmetic expression.&lt;/P&gt;
&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lisa_Sessions_0-1644426330752.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68318i40E2F56F1B43C68C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lisa_Sessions_0-1644426330752.png" alt="Lisa_Sessions_0-1644426330752.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table medicaresalesagencies3 as
		select distinct
			a.agency_name,
			a.aor_code,  
			a.agency_type,
			/*a.'Level 3'n as 'Level 3'n,*/
			/*case 
			when a.'Level 2'n is null then a.aor_code
			else a.'Level 2'n end as 'Level_Down 2'n,*/
			case 
			when a.TOH_agency is null then a.aor_code
			else a.TOH_agency end as 'TOH_AGENCY'n,
            compbl(strip(cat(propcase(a.agents_name)," ",propcase(a.agents_last_name)))) as agent_name,
			a.role,
			a.agent_individual_writing_number,
			a.license,    
			a.agent_npn,
			/*a.agent_email_address,
			a.agent_work_phone_number,*/
			/*a.agent_start_date,
			a.agent_end_date,*/ 
			/*a.agent_address,
			a.agent_address_line_2,
			propcase(a.cty_nm) as cty_nm,*/
			a.usps_stt_cd,
			a.zip_code,
			a.county,
			a.rts_goals_per_county,
			a.broker_managers,
			a.assigned_broker_manager,
			/*a.country_name,
			a.lat_nb,
			a.long_nb,*/ 
			a.cms_pass_fail,
			a.cms_cert_eff_date,
			a.cms_cert_term_date,
			a.course_title,
			a.certification_status,
			b.SITE_LICENSES as AHIP_ON_FILE,
			b.ahip_status,
			case when role = "Agent" and max(year(CMS_CERT_TERM_DATE)) ne 2022 and b.SITE_LICENSES is missing then 'AHIP Needed' /*else 'AHIP OnFile'*/
				end as CHECK_AHIP,
			case when role = "Agent" and max(year(CMS_CERT_TERM_DATE)) eq 2022 and b.SITE_LICENSES is not missing then 'RTS 2022' 
				end as Agents_Status,
			case when role = "Agent" and max(year(CMS_CERT_TERM_DATE)) ne 2022 and b.SITE_LICENSES is not missing then 'Ready To Train' /*else 'Not RTT'*/
				end as TRAIN_INDICATOR
	from medicaresalesagencies2 a
		left join cpm1p1.ahip_dmp b
			on a.agent_npn = b.npn
		where a.aor_code not in ('K001','K003')
		/*and a.role in ('Agent')*/
	group by 
		a.agent_npn
	order by a.aor_code asc;
/*		AHIP_Submission asc;*/
quit;

data medicaresalesagencies3;
set medicaresalesagencies3;
if CHECK_AHIP='' and Agents_Status='' and TRAIN_INDICATOR='' then CHECK_AHIP='';
if CHECK_AHIP='AHIP Needed' and Agents_Status='' and TRAIN_INDICATOR='' then CHECK_AHIP = 'AHIP Needed';
if CHECK_AHIP='' and Agents_Status='RTS 2022' and TRAIN_INDICATOR='' then CHECK_AHIP='RTS 2022';
if CHECK_AHIP='' and Agents_Status='' and TRAIN_INDICATOR='Ready To Train' then CHECK_AHIP = 'Ready To Train';
format CHECK_AHIP $25.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 17:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795231#M255042</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-02-09T17:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Changing length of char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795240#M255046</link>
      <description>&lt;P&gt;You should use the `length = ` option in a PROC SQL query. Here's an example -- your code is pretty long so I just made a fake example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table 	want as
		select
					*,
					case 	when make = "Toyota" then "It's a Toyota!"
							when make = "Ford" then "Ford!"
							else "What kind of car is this?"
					end as 	test_var length = 25
		from
					sashelp.cars;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maguiremq_0-1644427737670.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68323i353A04984AE4C318/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maguiremq_0-1644427737670.png" alt="maguiremq_0-1644427737670.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Unless you have a format that's already specified in a PROC FORMAT step.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 17:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795240#M255046</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2022-02-09T17:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Changing length of char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795241#M255047</link>
      <description>&lt;P&gt;This is not a format issue but a LENGTH issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when role = "Agent" and max(year(CMS_CERT_TERM_DATE)) ne 2022 and b.SITE_LICENSES is missing 
then 'AHIP Needed' /*else 'AHIP OnFile'*/ end as CHECK_AHIP length=25&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Feb 2022 17:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795241#M255047</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-09T17:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Changing length of char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795243#M255048</link>
      <description>Thank you, Paige!!&lt;BR /&gt;length=25 worked!!&lt;BR /&gt;I've only been trying to figure this out for 2 hours, grrrrrr&lt;BR /&gt;&lt;BR /&gt;Thanks again!!</description>
      <pubDate>Wed, 09 Feb 2022 17:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795243#M255048</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-02-09T17:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Changing length of char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795244#M255049</link>
      <description>&lt;P&gt;Thank you for the example!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 17:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-length-of-char-variable/m-p/795244#M255049</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-02-09T17:35:24Z</dc:date>
    </item>
  </channel>
</rss>

