<?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 Using a Wildcard to Create a New Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Wildcard-to-Create-a-New-Variable/m-p/690137#M209902</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that has degree program names that end with the degree type. I want to create a new variable with just these variable types that are tacked on to the end of the program names (BS, BSEd, M.Ac, MS, etc.). I figured a wildcard% would work for this but it is not working like I thought it would. Here are two tests I did trying to get it to work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Programs_With_States_IND;
	set work.PROGRAMS_WITH_STATES_IND;
		if Degree_Program_Name like '%BS%'
		then Degree_Type = 'BS';

		else if Degree_Program_Name like '%M.Ac%'
		then Degree_Type = 'M.Ac';

		else if Degree_Program_Name like '%MAT%'
		then Degree_Type = 'MAT';

		else if Degree_Program_Name like '%MA%'
		then Degree_Type = 'MA';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table prog_test as
		select *, case 
			when Degree_Program_Name like '%BS%' then 'BS'
			
			when Degree_Program_Name like '%MA%' then 'MA'
		end as Degree_Type
		from work.programs_with_states_ind;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help would be appreciated! Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 18:52:00 GMT</pubDate>
    <dc:creator>dpachorek</dc:creator>
    <dc:date>2020-10-08T18:52:00Z</dc:date>
    <item>
      <title>Using a Wildcard to Create a New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Wildcard-to-Create-a-New-Variable/m-p/690137#M209902</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that has degree program names that end with the degree type. I want to create a new variable with just these variable types that are tacked on to the end of the program names (BS, BSEd, M.Ac, MS, etc.). I figured a wildcard% would work for this but it is not working like I thought it would. Here are two tests I did trying to get it to work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Programs_With_States_IND;
	set work.PROGRAMS_WITH_STATES_IND;
		if Degree_Program_Name like '%BS%'
		then Degree_Type = 'BS';

		else if Degree_Program_Name like '%M.Ac%'
		then Degree_Type = 'M.Ac';

		else if Degree_Program_Name like '%MAT%'
		then Degree_Type = 'MAT';

		else if Degree_Program_Name like '%MA%'
		then Degree_Type = 'MA';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table prog_test as
		select *, case 
			when Degree_Program_Name like '%BS%' then 'BS'
			
			when Degree_Program_Name like '%MA%' then 'MA'
		end as Degree_Type
		from work.programs_with_states_ind;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help would be appreciated! Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 18:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-Wildcard-to-Create-a-New-Variable/m-p/690137#M209902</guid>
      <dc:creator>dpachorek</dc:creator>
      <dc:date>2020-10-08T18:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Wildcard to Create a New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Wildcard-to-Create-a-New-Variable/m-p/690141#M209903</link>
      <description>LIKE isn't valid in a data step, instead look at the FIND() and INDEX() functions for similar functionality.</description>
      <pubDate>Thu, 08 Oct 2020 18:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-Wildcard-to-Create-a-New-Variable/m-p/690141#M209903</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-08T18:57:44Z</dc:date>
    </item>
  </channel>
</rss>

