<?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: How to map text values among columns? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/810532#M319621</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/392529"&gt;@binhle50&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks so much for your great solution. I will try and let you know. The data is actually not in that structure. each method will be asked separately and has its own field. I tried to combine all fields together (around 20 fields) into a single fields using || as a separator.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;&lt;BR /&gt;Le&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like it could have been easier to use the original structure.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Apr 2022 05:09:31 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-04-29T05:09:31Z</dc:date>
    <item>
      <title>How to map text values among columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809752#M319330</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;
&lt;P&gt;I would highly appreciate if anyone could help me to map each procedure with its date as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 3 variables ID; Date; and Procedure as shown below (where the date variable contains multiple dates separated by "||" and the procedure variable also contains multiple procedures separated by "||" The order of the date will map with the order of the procedure)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Procedure&lt;/P&gt;
&lt;P&gt;1000&amp;nbsp; &amp;nbsp;2010-10-13 || &lt;EM&gt;2010-03-10&lt;/EM&gt; || 2004-04-01 || 2002-01-01 || &lt;EM&gt;1990-01-01&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; NA || &lt;EM&gt;Orthopedic&lt;/EM&gt; || NA || NA ||&amp;nbsp;&amp;nbsp;&lt;EM&gt;Orthopedic&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want (I just want to map out each orthopedic to each date and ignore everything else):&lt;/P&gt;
&lt;P&gt;Id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Procedure&lt;/P&gt;
&lt;P&gt;1000&amp;nbsp; &amp;nbsp; &amp;nbsp;2010-03-10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Orthopedic&lt;/P&gt;
&lt;P&gt;1000&amp;nbsp; &amp;nbsp; &amp;nbsp;1990-01-01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Orthopedic&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope someone can help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Le&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 17:46:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809752#M319330</guid>
      <dc:creator>binhle50</dc:creator>
      <dc:date>2022-04-25T17:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to map text values among columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809795#M319350</link>
      <description>&lt;P&gt;Here you go. The DO loop doesn't depend on a fixed number of pairs of dates and procedures, so each patient can have a varying number if that's the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards;
input ID  _Dates :$100. _Procedures :$100.;
cards;
1000  2010-10-13||2010-03-10||2004-04-01||2002-01-01||1990-01-01  NA||Orthopedic||NA||NA||Orthopedic
;
run;

data want;
set have;
do _i = 1 by 1;
    _dt = scan(_dates, _i, '|');
    if missing(_dt) then leave; * reached the end of the list. exit loop;
    date = input(_dt, yymmdd10.);
    format date yymmdd10.;
    procdure = scan(_procedures, _i, '|');
    if procdure = 'Orthopedic' then output;
end; 
drop _:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 00:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809795#M319350</guid>
      <dc:creator>average_joe</dc:creator>
      <dc:date>2022-04-26T00:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to map text values among columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809808#M319358</link>
      <description>&lt;P&gt;Naming a variable "Proc" can cause confusion, so i changed it to "method".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/345100"&gt;@average_joe&lt;/a&gt; for providing data in a useful form.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(keep= ID Method Date);
   set have;
   
   length Method $ 30 Date 8;
   format Date yymmddd10.;
   
   d = countw(Dates, '|');
   p = countw(Procedures, '|');
   
   if d ^= p then do;
      put 'ERROR: Number of values in Dates/Procedures is not the same.';
      stop;
   end;
   
   do i = 1 to p;
      Method = scan(Procedures, i, '|');
      if Method = 'Orthopedic' then do;
         Date = input(scan(Dates, i, '|'), yymmdd10.);
         output;
       end;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would inquire, why the data was created in such an ugly and useless structure in the first place.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 06:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809808#M319358</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-04-26T06:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to map text values among columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809864#M319389</link>
      <description>Thanks so much for your great solution. I will try and let you know. The data is actually not in that structure. each method will be asked separately and has its own field. I tried to combine all fields together (around 20 fields) into a single fields using || as a separator.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;&lt;BR /&gt;Le</description>
      <pubDate>Tue, 26 Apr 2022 13:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809864#M319389</guid>
      <dc:creator>binhle50</dc:creator>
      <dc:date>2022-04-26T13:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to map text values among columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809868#M319391</link>
      <description>Thanks so much! It seems working great. Yes the pairs are not fixed, some records have no pairs but some may have 10 pairs and the date sometimes missing months or days or both months and days. &lt;BR /&gt;Anyway, I think this is a great solution.&lt;BR /&gt;&lt;BR /&gt;Again, thanks so much for your help!&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;&lt;BR /&gt;Le</description>
      <pubDate>Tue, 26 Apr 2022 13:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/809868#M319391</guid>
      <dc:creator>binhle50</dc:creator>
      <dc:date>2022-04-26T13:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to map text values among columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/810532#M319621</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/392529"&gt;@binhle50&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks so much for your great solution. I will try and let you know. The data is actually not in that structure. each method will be asked separately and has its own field. I tried to combine all fields together (around 20 fields) into a single fields using || as a separator.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;&lt;BR /&gt;Le&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like it could have been easier to use the original structure.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 05:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-map-text-values-among-columns/m-p/810532#M319621</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-04-29T05:09:31Z</dc:date>
    </item>
  </channel>
</rss>

