<?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: Creating new variables from a huge text string variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858938#M339376</link>
    <description>&lt;P&gt;Thanks for the quick reply. I am trying to create new variables using the text string variable "Shared_services" . In a data set of 150 observations, 19 replied to this variable 'Shared_services" with text response&amp;nbsp;&lt;STRONG&gt;Other. Shared care management and care coordination system for medical needs Shared infrastructure for social needs services. Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this text string response,&amp;nbsp; I want to create new variables&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Shared_services =: "management structure" then managementn=1; else managementn=0;&lt;BR /&gt;if Shared_services =: "physical infrastructure" then physical_infrastructuren=1; else physical_infrastructuren=0;&lt;BR /&gt;if Shared_services =: "personnel responsibilities" then personnel_responsibilitiesn=1; else personnel_responsibilitiesn=0;&lt;BR /&gt;if Shared_services =: "revenues and expenses" then revenues_and_expensesn=1; else revenues_and_expensesn=0;&lt;BR /&gt;if Shared_services =: "technical infrastructure" then technical_infrastructuren=1; else technical_infrastructuren=0;&lt;BR /&gt;if Shared_services =: "care management" then care_managementn=1; else care_managementn=0;&lt;BR /&gt;if Shared_services =: "social needs services" then social_needs_servicesn=1; else social_needs_servicesn=0;&lt;BR /&gt;if Shared_services =: "best practices" then best_practicesn=1; else best_practicesn=0;&lt;BR /&gt;if Shared_services =: "Other" then shared_othern=1; else shared_othern=0;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 14:16:57 GMT</pubDate>
    <dc:creator>sms1891</dc:creator>
    <dc:date>2023-02-15T14:16:57Z</dc:date>
    <item>
      <title>Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858930#M339373</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;I have a huge string variable Shared_interests (only 19 out of 150 responded to this question. But the response is a huge text string "&lt;STRONG&gt;Other. Shared care management and care coordination system for medical needs Shared infrastructure for social needs services. Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices.&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;I have to create new variables from this and I tried a few methods (by using like, contains, =:, %) but unsuccessful. I would appreciate your help greatly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data a;

Set a;

if Shared_services =: "management structure" then managementn=1; else managementn=0;
if Shared_services =: "physical infrastructure" then physical_infrastructuren=1; else physical_infrastructuren=0;
if Shared_services =: "personnel responsibilities" then personnel_responsibilitiesn=1; else personnel_responsibilitiesn=0;
if Shared_services =: "revenues and expenses" then revenues_and_expensesn=1; else revenues_and_expensesn=0;
if Shared_services =: "technical infrastructure" then technical_infrastructuren=1; else technical_infrastructuren=0;
if Shared_services =: "care management" then care_managementn=1; else care_managementn=0;
if Shared_services =: "social needs services" then social_needs_servicesn=1; else social_needs_servicesn=0;
if Shared_services =: "best practices" then best_practicesn=1; else best_practicesn=0;
if Shared_services =: "Other" then shared_othern=1; else shared_othern=0;

run;&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;Thank you&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Feb 2023 13:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858930#M339373</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2023-02-15T13:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858935#M339375</link>
      <description>&lt;P&gt;I'm sorry but the question is unclear to me&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I have a huge string variable Shared_interests&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean you have a huge string variable named Shared_services?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Exactly what are you trying to do with this huge string variable, you don't really say. You say what you tried that didn't work, but we don't really know what it is that you are looking for. I make a guess: do you want to find if Shared_services CONTAINS&amp;nbsp;"management structure"? Is that right, or is my guess wrong? If that's not right, then please spell out exactly what result you do want.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858935#M339375</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-15T14:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858938#M339376</link>
      <description>&lt;P&gt;Thanks for the quick reply. I am trying to create new variables using the text string variable "Shared_services" . In a data set of 150 observations, 19 replied to this variable 'Shared_services" with text response&amp;nbsp;&lt;STRONG&gt;Other. Shared care management and care coordination system for medical needs Shared infrastructure for social needs services. Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this text string response,&amp;nbsp; I want to create new variables&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Shared_services =: "management structure" then managementn=1; else managementn=0;&lt;BR /&gt;if Shared_services =: "physical infrastructure" then physical_infrastructuren=1; else physical_infrastructuren=0;&lt;BR /&gt;if Shared_services =: "personnel responsibilities" then personnel_responsibilitiesn=1; else personnel_responsibilitiesn=0;&lt;BR /&gt;if Shared_services =: "revenues and expenses" then revenues_and_expensesn=1; else revenues_and_expensesn=0;&lt;BR /&gt;if Shared_services =: "technical infrastructure" then technical_infrastructuren=1; else technical_infrastructuren=0;&lt;BR /&gt;if Shared_services =: "care management" then care_managementn=1; else care_managementn=0;&lt;BR /&gt;if Shared_services =: "social needs services" then social_needs_servicesn=1; else social_needs_servicesn=0;&lt;BR /&gt;if Shared_services =: "best practices" then best_practicesn=1; else best_practicesn=0;&lt;BR /&gt;if Shared_services =: "Other" then shared_othern=1; else shared_othern=0;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858938#M339376</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2023-02-15T14:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858939#M339377</link>
      <description>&lt;P&gt;Sorry, the variable name is Shared_services.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858939#M339377</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2023-02-15T14:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858940#M339378</link>
      <description>&lt;P&gt;The FIND function is your friend here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	Shared_services="Other. Shared care management and care coordination system for medical needs Shared infrastructure for social needs services. Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices.";
	output;
	Shared_services="Other. Care management and care coordination system for medical needs Shared infrastructure for social needs services.";
	output;
	Shared_services="Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices.";
	output;
	Shared_services="management structure. Best practices.";
	output;
run;

data want;
   set have;
	managementn=find(lowcase(Shared_services),"management structure")&amp;gt;0;
	physical_infrastructuren=find(lowcase(Shared_services),"physical infrastructure")&amp;gt;0;
	personnel_responsibilitiesn=find(lowcase(Shared_services),"personnel responsibilities")&amp;gt;0;
	revenues_and_expensesn=find(lowcase(Shared_services),"revenues and expenses")&amp;gt;0;
	technical_infrastructuren=find(lowcase(Shared_services),"technical infrastructure")&amp;gt;0;
	care_managementn=find(lowcase(Shared_services),"care management")&amp;gt;0;
	social_needs_servicesn=find(lowcase(Shared_services),"social needs services")&amp;gt;0;
	best_practicesn=find(lowcase(Shared_services),"best practices")&amp;gt;0;
	shared_othern=find(lowcase(Shared_services),"Other")&amp;gt;0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And - tada!&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV id="IDX1"&gt;
&lt;TABLE class="table" aria-label="Data Set WORK.WANT"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="header" scope="col"&gt;Shared_services&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;managementn&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;physical_infrastructuren&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;personnel_responsibilitiesn&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;revenues_and_expensesn&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;technical_infrastructuren&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;care_managementn&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;social_needs_servicesn&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;best_practicesn&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;shared_othern&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="data"&gt;Other. Shared care management and care coordination system for medical needs Shared infrastructure for social needs services. Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices.&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="data"&gt;Other. Care management and care coordination system for medical needs Shared infrastructure for social needs services.&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="data"&gt;Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices.&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="data"&gt;management structure. Best practices.&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858940#M339378</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-02-15T14:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858941#M339379</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/146852"&gt;@sms1891&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the quick reply. I am trying to create new variables using the text string variable "Shared_services" . In a data set of 150 observations, 19 replied to this variable 'Shared_services" with text response&amp;nbsp;&lt;STRONG&gt;Other. Shared care management and care coordination system for medical needs Shared infrastructure for social needs services. Shared management structure. Shared personnel responsibilities. Shared physical infrastructure. Shared revenues and expenses. Shared technical infrastructure including EMR and other IT. Sharing of best practices. &lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You said this already, and repeating this does not clear up any of my confusion. When you only tell us what didn't work, we don't really know what you want to do with this long string variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858941#M339379</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-15T14:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858942#M339380</link>
      <description>&lt;P&gt;PaigeMiller, I posted the SAS code in my original post for what I wanted.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858942#M339380</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2023-02-15T14:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858944#M339382</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/146852"&gt;@sms1891&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;PaigeMiller, I posted the SAS code in my original post for what I wanted.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And that didn't work, you told us that. But we don't know what result would make you happy, you still have not explained. I am not asking for code, I am asking for explanation.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858944#M339382</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-15T14:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858949#M339385</link>
      <description>&lt;P&gt;My code specifies what I wanted. I think SASJedi got it. I will try his code and see if it works. Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 14:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858949#M339385</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2023-02-15T14:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858962#M339389</link>
      <description>&lt;P&gt;Hi SASJedi, I think I got everything except the "Other". I want only the ones which says "Other" at the beginning with largecap O and not at other instances where there is a mention of 'other'. Is this possible to filter out for shared_othern?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858962#M339389</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2023-02-15T15:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858965#M339392</link>
      <description>&lt;P&gt;Let's see if I can translate.&lt;/P&gt;
&lt;P&gt;You have a character variable that can have many different substrings included within it (so basically a list of the items selected on a multiple select survey question)&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input string $80.;
cards;
item1, item2
item3, item4,item6
item1, item4
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you want to generate a series of boolean variables that indicate if specific substrings were included or not. The =: operator you tried only tests if the strings starts with a particular value.&amp;nbsp; It looks like you would want to search the whole string. So use the FIND() or perhaps FINDW() function instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   item1 = 0&amp;lt;findw(string,'item1',' ,.','i');
   item2 = 0&amp;lt;findw(string,'item2',' ,.','i');
   item3 = 0&amp;lt;findw(string,'item3',' ,.','i');
   item4 = 0&amp;lt;findw(string,'item4',' ,.','i');
   item5 = 0&amp;lt;findw(string,'item5',' ,.','i');
   item6 = 0&amp;lt;findw(string,'item6',' ,.','i');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;Obs    string                item1    item2    item3    item4    item5    item6

 1     item1, item2            1        1        0        0        0        0
 2     item3, item4,item6      0        0        1        1        0        1
 3     item1, item4            1        0        0        1        0        0
&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/858965#M339392</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-15T15:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variables from a huge text string variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/859179#M339478</link>
      <description>&lt;P&gt;Ah, yes - my mistake, there. The LOWCASE function in the line that detects "Other" is screwing things up.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;shared_othern=find(&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;lowcase(&lt;/STRONG&gt;&lt;/FONT&gt;Shared_services&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;,"Other")&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This would work as you described:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
	managementn=find(lowcase(Shared_services),"management structure")&amp;gt;0;
	physical_infrastructuren=find(lowcase(Shared_services),"physical infrastructure")&amp;gt;0;
	personnel_responsibilitiesn=find(lowcase(Shared_services),"personnel responsibilities")&amp;gt;0;
	revenues_and_expensesn=find(lowcase(Shared_services),"revenues and expenses")&amp;gt;0;
	technical_infrastructuren=find(lowcase(Shared_services),"technical infrastructure")&amp;gt;0;
	care_managementn=find(lowcase(Shared_services),"care management")&amp;gt;0;
	social_needs_servicesn=find(lowcase(Shared_services),"social needs services")&amp;gt;0;
	best_practicesn=find(lowcase(Shared_services),"best practices")&amp;gt;0;
	&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;shared_othern=find(Shared_services,"Other")&amp;gt;0;&lt;/FONT&gt;&lt;/STRONG&gt;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Feb 2023 13:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-from-a-huge-text-string-variable/m-p/859179#M339478</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-02-16T13:17:32Z</dc:date>
    </item>
  </channel>
</rss>

