<?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: Logic needed! in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48120#M12995</link>
    <description>If you are still having difficulty with TRANWRD, share the SAS-generated log, not just your "copied" SAS code variables - consider your recent reply had an inconsistent SAS variable name.  Honest....the code works, when you have TRIM specified on both arguments #2 and #3 for the TRANWRD assignment statement.&lt;BR /&gt;
&lt;BR /&gt;
Also -- there's no need to carry more data than absolutely necessary - use a JOIN or DATA step MERGE to get the result needed at the optimal processing point.&lt;BR /&gt;
&lt;BR /&gt;
Suggest you develop an approach, share the code, and seek feedback from the forum subscribers -- again, you know your data best as we are not familiar with your environment, nor the SAS processing results.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Tue, 13 Jul 2010 20:34:19 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-07-13T20:34:19Z</dc:date>
    <item>
      <title>Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48107#M12982</link>
      <description>I desperatley need your help. Completely new to SAS. Thsi is one part of what I have to do. &lt;BR /&gt;
&lt;BR /&gt;
I have 2 tables/SAS datasets. &lt;BR /&gt;
Customer	cust_TYP	cust_ID	FIELD_NM	                 FIELD_TX&lt;BR /&gt;
123	EVT	23	PTY NAME	JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
123	EVT	13	PTY NAME	APRIL LI, BBC COMPANY AND WHOKNOW WHAT&lt;BR /&gt;
123	EVT	3	PTY NAME	JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
123	EVT	3	DC_RSN_DE	CASH DEPOSIT&lt;BR /&gt;
123	EVT	13	DC_RSN_DE	CASH DEPOSIT&lt;BR /&gt;
123	EVT	23	DC_RSN_DE	TRANSACTION &lt;BR /&gt;
&lt;BR /&gt;
Customer  cust_typ  MSG_id  Msg_txt&lt;BR /&gt;
123            EVT         1          THIS EVT IS &lt;DC_RSN_DE&gt;&lt;/DC_RSN_DE&gt; CASE FOR &lt;PTY name=""&gt;&lt;/PTY&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
So I have to match these 2 tables/SAS datasets on Customer and then teh final output should be -&lt;BR /&gt;
THIS EVT IS CASH DEPOSIT CASE FOR JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY. &lt;BR /&gt;
&lt;BR /&gt;
Can you please tell me how to accomplish this?&lt;BR /&gt;
Any help is appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thank you!!</description>
      <pubDate>Mon, 12 Jul 2010 18:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48107#M12982</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-12T18:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48108#M12983</link>
      <description>Consider using a DATA step approach with a MERGE and a BY statement (input must be sorted), along with a SAS assignment statement using the TRANWRD function.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
data step programming site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
tranwrd function site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
merge by processing site:sas.com</description>
      <pubDate>Mon, 12 Jul 2010 19:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48108#M12983</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-12T19:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48109#M12984</link>
      <description>I serached and did find the tranwrd function and I was trying to use a variable as the replacement string. But some how it does not work.&lt;BR /&gt;
&lt;BR /&gt;
data convert;&lt;BR /&gt;
   input @1 address $20. ;&lt;BR /&gt;
  var var1;&lt;BR /&gt;
var1 = 'John Smith' ;&lt;BR /&gt;
   *** Convert Street, Avenue and&lt;BR /&gt;
   Boulevard to their abbreviations;&lt;BR /&gt;
   Address = tranwrd(address,'Street',var1);&lt;BR /&gt;
   Address = tranwrd(address,'Avenue','Ave.');&lt;BR /&gt;
   Address = tranwrd(address,'Road','Rd.');&lt;BR /&gt;
datalines;&lt;BR /&gt;
89 Lazy Brook Road &lt;BR /&gt;
123 River Rd.&lt;BR /&gt;
12 Main Street&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
Can you help?</description>
      <pubDate>Mon, 12 Jul 2010 20:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48109#M12984</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-12T20:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48110#M12985</link>
      <description>Your code is syntactically incorrect. In the SAS editor the line: VAR VAR1; will be coloured red because it is not valid. Also did you check your SAS log after running this step as it will highlight this statement with an error 180 - this statement is not valid.&lt;BR /&gt;
&lt;BR /&gt;
Remove the incorrect statement and you will find it works fine. You need to check your SAS log every time you run a program to confirm if it ran without error or not. This is even more important when you are just starting out learning SAS. SAS log messages are usually very good at highlighting errors and problems.&lt;BR /&gt;
&lt;BR /&gt;
Good luck!</description>
      <pubDate>Mon, 12 Jul 2010 21:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48110#M12985</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-07-12T21:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48111#M12986</link>
      <description>Hi. I am curiosity that if two dataset have the same ' Customer ',why not  be 'THIS EVT IS &lt;B&gt;TRANSACTION&lt;/B&gt;  CASE FOR JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY. '</description>
      <pubDate>Tue, 13 Jul 2010 11:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48111#M12986</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-07-13T11:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48112#M12987</link>
      <description>Thank you! I did fix that and now trying to use the tranwrd function to replace strings.&lt;BR /&gt;
But I am facing a problem when I have replace a string in the iddle of a text. It does replace the string but wipes off the text after it in the msg.&lt;BR /&gt;
So my initial txt is like :&lt;BR /&gt;
THIS EVT IS &lt;REASON&gt; FOR &lt;PTY&gt;.&lt;BR /&gt;
I have to replace both reason and pty with 'cash deposit' and 'john smith..'. Now it replaces reason but eats up the msg after it.&lt;BR /&gt;
My o/p shd be :&lt;BR /&gt;
THIS EVT IS CASH DEPOSIT FOR JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
but my o/p is:&lt;BR /&gt;
THIS EVT IS CASH DEPOSIT.&lt;BR /&gt;
&lt;BR /&gt;
Any directions?&lt;/PTY&gt;&lt;/REASON&gt;</description>
      <pubDate>Tue, 13 Jul 2010 18:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48112#M12987</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-13T18:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48113#M12988</link>
      <description>Just a thought, what is the length of the new variable?  If it is too short it might just be getting truncated.</description>
      <pubDate>Tue, 13 Jul 2010 18:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48113#M12988</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-07-13T18:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48114#M12989</link>
      <description>New variable is 3000 char.</description>
      <pubDate>Tue, 13 Jul 2010 18:23:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48114#M12989</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-13T18:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48115#M12990</link>
      <description>You should be able to test the SAS processing behavior outside of your application to verify what's expected of the SAS system, using some "test" data that mimics your application.  &lt;BR /&gt;
&lt;BR /&gt;
Then, if that works, you will want/need to interrogate your code processing, using PUT _ALL_;  commands placed in your DATA step at various locations for self-initiated debugging efforts.  This diagnosis effort will help increase your confidence that a particular process / function in SAS does in fact work, and then with you being the best individual to debug the situation, you can see about possibly working with a smaller subset of your data and using various techniques like using OBS=nnn or doing a IF _n_ &amp;gt; ???? THEN  STOP;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 13 Jul 2010 18:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48115#M12990</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-13T18:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48116#M12991</link>
      <description>Thanks for ur input. But I did try a few debuggig steps, but it does not work when the string to be replaced is on the middle.I also reduced teh field name from 3000 char to 100 char. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data MYDATA.csa;&lt;BR /&gt;
set mydata.csa;&lt;BR /&gt;
put msg_txt;&lt;BR /&gt;
msg_txt =tranwrd(msg_txt,trim(field_nm),field_tx);&lt;BR /&gt;
put msg_txt;&lt;BR /&gt;
msg_txt = compress(msg_txt,'(&amp;lt;)');&lt;BR /&gt;
put _all_;&lt;BR /&gt;
PUT '****';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
this is my log.&lt;BR /&gt;
THIS EVT IS &lt;REASON_CD&gt;&lt;/REASON_CD&gt; CASE FOR &lt;PTY name=""&gt;&lt;/PTY&gt;&lt;BR /&gt;
THIS EVT IS &lt;CASH deposit=""&gt;&lt;BR /&gt;
Customer=123 FIELD_NM=REASON_CD FIELD_TX=CASH DEPOSIT MSG_TXT=THIS EVT IS &lt;CASH deposit="" _error_="0" _n_="3&amp;lt;br"&gt;
THIS EVT IS &lt;CASH deposit=""&gt;&lt;BR /&gt;
&lt;BR /&gt;
Can anyone please help!

Message was edited by: sasnewbee&lt;/CASH&gt;&lt;/CASH&gt;&lt;/CASH&gt;</description>
      <pubDate>Tue, 13 Jul 2010 19:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48116#M12991</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-13T19:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48117#M12992</link>
      <description>I ran your code with assigned SAS variables - you need to trim each of your two TRANWRD arguments so that only the non-blank characters are replaced.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 13 Jul 2010 19:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48117#M12992</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-13T19:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48118#M12993</link>
      <description>Exactly ! thats what I did. I trimmed both my variables field_txt and Field_nm and also reduced their length.&lt;BR /&gt;
&lt;BR /&gt;
Thank you!</description>
      <pubDate>Tue, 13 Jul 2010 20:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48118#M12993</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-13T20:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48119#M12994</link>
      <description>I now need to choose the approach. I mentioned that I have MSg in one table and the text that needs to be inserted (field_tx) in another table. Currently I have all these columns in one table. Now if I have to do a join in a data step will it be tedious? Or should I use an additional step before this data step, to add the field_tx data  to Msg table, so that I have all in data in one table? &lt;BR /&gt;
&lt;BR /&gt;
Thanks!!!</description>
      <pubDate>Tue, 13 Jul 2010 20:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48119#M12994</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-13T20:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48120#M12995</link>
      <description>If you are still having difficulty with TRANWRD, share the SAS-generated log, not just your "copied" SAS code variables - consider your recent reply had an inconsistent SAS variable name.  Honest....the code works, when you have TRIM specified on both arguments #2 and #3 for the TRANWRD assignment statement.&lt;BR /&gt;
&lt;BR /&gt;
Also -- there's no need to carry more data than absolutely necessary - use a JOIN or DATA step MERGE to get the result needed at the optimal processing point.&lt;BR /&gt;
&lt;BR /&gt;
Suggest you develop an approach, share the code, and seek feedback from the forum subscribers -- again, you know your data best as we are not familiar with your environment, nor the SAS processing results.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 13 Jul 2010 20:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48120#M12995</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-13T20:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48121#M12996</link>
      <description>Thank you for following up on this. What I mean in my earlier post was , I did trim 2 variables and it worked out as expected.&lt;BR /&gt;
Now here is how my data looks like.&lt;BR /&gt;
STORY_OUT&lt;BR /&gt;
CUST_ID	CUST_TYP    MSG_ID	MSG_TX &lt;BR /&gt;
123	EVT	     234	THIS EVT IS &lt;REASON_CD&gt;&lt;/REASON_CD&gt; CASE FOR &lt;PARTY&gt;&lt;/PARTY&gt;&lt;BR /&gt;
				&lt;BR /&gt;
&lt;BR /&gt;
This will find 2 matches in CSA table as below: &lt;BR /&gt;
CSA&lt;BR /&gt;
CUST_ID	CUST_TYP    FIELD_NM	FIELD_TX&lt;BR /&gt;
123	EVT	    PARTY NAME	JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
123	EVT	    REASON_CD	CASH DEPOSIT&lt;BR /&gt;
&lt;BR /&gt;
How can I get both records in this case? I am thinking of creating a temp table which replicates the story table and an additionals  - FIELD_NM, field_txt from the CSA table. This will basically help in using TRANWRD if both tehse columns along with MSG_TXT is in the same table.   It does not work if I do a left or inner join. If I do an Outer join, the second record of CSA tabel gets added but Story table fields are blank. Any directions or any other suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Wed, 14 Jul 2010 17:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48121#M12996</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-14T17:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48122#M12997</link>
      <description>I believe that you are working with "vertical" observation oriented data, where you need to access multiple "source table" data-values with multipleTRANWRD searches.&lt;BR /&gt;
&lt;BR /&gt;
Possibly, look at using PROC TRANSPOSE to create a horizontal perspective for your source data-values, and also a MERGE to associate all related observations using a suitable BY statement, and then you will have your TRANWRD variables to access in your assignment statement.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 14 Jul 2010 18:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48122#M12997</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-14T18:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48123#M12998</link>
      <description>This is my first SAS assignment so I would appreciate if you couls elaborate further.</description>
      <pubDate>Wed, 14 Jul 2010 19:23:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48123#M12998</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-14T19:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48124#M12999</link>
      <description>Can I use a Merge without a BY to get the temporary table ?</description>
      <pubDate>Wed, 14 Jul 2010 19:26:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48124#M12999</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-14T19:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48125#M13000</link>
      <description>You need the BY statement for the MERGE to work properly - this process will combine your conditional variable values based on the BY key.&lt;BR /&gt;
&lt;BR /&gt;
Share what code you have thus far, for comment/feedback, preferably within a SASLOG output (pasted in your reply), along with a PUT _ALL_;  to show how your TRANWRD function usage (in two assignment statements) resolves values.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 15 Jul 2010 14:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48125#M13000</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-15T14:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Logic needed!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48126#M13001</link>
      <description>This is the code I managed till now:&lt;BR /&gt;
CSA table &lt;BR /&gt;
Cust_id  cust_typ cust_no   Field_nm            Field_txt &lt;BR /&gt;
123        EVT	23     PARTY NAME	JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
123       EVT	13     PARTY NAME	APRIL LI ,BBC COMPANY&lt;BR /&gt;
123      EVT	3       PARTY NAME	JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
123       EVT	3       REASON_CD	CASH DEPOSIT&lt;BR /&gt;
123       EVT	13     REASON_CD	CASH DEPOSIT&lt;BR /&gt;
123       EVT	23     REASON_CD	TRX CTRY WIRE&lt;BR /&gt;
&lt;BR /&gt;
Story_msg_out table:&lt;BR /&gt;
Cust_id  cust_typ cust_no   msg_id msg_seq_no  msg_txt &lt;BR /&gt;
123	EVT	23     234	       1	       THIS IS ABOUT &lt;PARTY name=""&gt;&lt;/PARTY&gt;&lt;BR /&gt;
123	EVT	13     23456     1	THIS IS NOTHING&lt;BR /&gt;
123	EVT	3       234	      1	THIS EVT IS &lt;REASON_CD&gt;&lt;/REASON_CD&gt; CASE FOR &lt;PARTY name=""&gt;&lt;/PARTY&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
libname mydata 'C:\' ;&lt;BR /&gt;
proc sql ; &lt;BR /&gt;
drop table mydata.epc_story_tmp;&lt;BR /&gt;
create table mydata.epc_story_tmp as&lt;BR /&gt;
(select  distinct a.cust_id, a.cust_typ, a.cust_no,  a.field_nm, a.field_tx ,m.msg_id, m.msg_seq_no,m.msg_txt from  mydata.epc_csa a&lt;BR /&gt;
 left join mydata.epc_story_msg_out m &lt;BR /&gt;
 on m.cust_id = a.cust_id and m.cust_typ = a.cust_typ and m.cust_no = a.cust_no &lt;BR /&gt;
 ) ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PROC SORT DATA=mydata.epc_story_tmp OUT=mydata.epc_story_sort ;&lt;BR /&gt;
  BY cust_id cust_typ cust_no msg_id msg_seq_no msg_txt;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=mydata.epc_story_sort out = mydata.tmp ;&lt;BR /&gt;
by cust_id cust_typ cust_no msg_id msg_seq_no msg_txt;&lt;BR /&gt;
var field_tx ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
TMP table after transpose looks like this. &lt;BR /&gt;
Cust_id  cust_typ cust_no   msg_id msg_seq_no  msg_txt &lt;BR /&gt;
123       EVT         3	         234	     1	          THIS EVT IS &lt;REASON_CD&gt;&lt;/REASON_CD&gt; CASE FOR &lt;PARTY name=""&gt;&lt;/PARTY&gt;	&lt;BR /&gt;
Formervariable  col1                    col2 &lt;BR /&gt;
FIELD_TX	       CASH DEPOSIT	JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
&lt;BR /&gt;
123    EVT	         13	         23456   1                    THIS IS NOTHING             FIELD_TX	CASH DEPOSIT	APRIL LI ,BBC COMPANY&lt;BR /&gt;
&lt;BR /&gt;
123   EVT	         23	        234	   1	    THIS IS ABOUT &lt;PARTY name=""&gt;&lt;/PARTY&gt; FIELD_TX	TRX CTRY WIRE	  JOHN SMITH, ADAM SMITH &amp;amp; BBC COMPANY&lt;BR /&gt;
&lt;BR /&gt;
I am using a tranwrd function on this tmp table. But how will tranwrd serach for 2 difft strings(party and reason_Cd) in the same text? IS there any other way to achieve this? I did not put the log since all queries run fine.&lt;BR /&gt;
&lt;BR /&gt;
data MYDATA.tmp;&lt;BR /&gt;
set mydata.tmp;&lt;BR /&gt;
put msg_txt;&lt;BR /&gt;
msg_txt =tranwrd(msg_txt,trim(field_nm),trim(field_tx));&lt;BR /&gt;
put msg_txt;&lt;BR /&gt;
msg_txt = compress(msg_txt,'()');&lt;BR /&gt;
put _all_;&lt;BR /&gt;
PUT '****';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thank you!!!</description>
      <pubDate>Thu, 15 Jul 2010 15:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-needed/m-p/48126#M13001</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-15T15:00:17Z</dc:date>
    </item>
  </channel>
</rss>

