<?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: New variable based on old one in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524555#M6798</link>
    <description>&lt;P&gt;tranWARD is not a function.&amp;nbsp; Don't use " ";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;4    %let zm = yrbrn edlvdee isco08 blgetmg;
5    %let zm2 = %sysfunc(transtrn(&amp;amp;zm,isco08,iscogrp));
6    %put &amp;amp;=zm2;
ZM2=yrbrn edlvdee iscogrp blgetmg
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jan 2019 14:38:28 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2019-01-04T14:38:28Z</dc:date>
    <item>
      <title>New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524553#M6797</link>
      <description>&lt;P&gt;Hi everyone.&lt;/P&gt;&lt;P&gt;I have perhaps simple question but I stacked with this code and I don't know how to&amp;nbsp;correct it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable called "zm". And I want to create a new variable (zm2) based on this first one. I tried a few codes like this below but not one of them works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let zm = yrbrn edlvdee isco08 blgetmg;&lt;/P&gt;&lt;P&gt;%let zm2 = %sysfunc(tranward(&amp;amp;zm, "isco08", "iscogrp"));&lt;BR /&gt;%put &amp;amp;zm2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to receive something like that:&lt;/P&gt;&lt;P&gt;zm2 =&amp;nbsp;&lt;SPAN&gt;yrbrn edlvdee ISCOGRP&amp;nbsp;blgetmg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could anyone help me?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 14:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524553#M6797</guid>
      <dc:creator>Margrett</dc:creator>
      <dc:date>2019-01-04T14:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524555#M6798</link>
      <description>&lt;P&gt;tranWARD is not a function.&amp;nbsp; Don't use " ";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;4    %let zm = yrbrn edlvdee isco08 blgetmg;
5    %let zm2 = %sysfunc(transtrn(&amp;amp;zm,isco08,iscogrp));
6    %put &amp;amp;=zm2;
ZM2=yrbrn edlvdee iscogrp blgetmg
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 14:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524555#M6798</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-01-04T14:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524560#M6799</link>
      <description>&lt;P&gt;Seems to me that the quotes are needed inside the transtrn function.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 14:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524560#M6799</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-04T14:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524562#M6800</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Seems to me that the quotes are needed inside the transtrn function.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not when using with SYSFUNC on macro variables.&amp;nbsp; Unless the quotes are part of the string you want to change.&amp;nbsp; Notice how this doesn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;7    %let zm = yrbrn edlvdee isco08 blgetmg;
8    %let zm2 = %sysfunc(transtrn(&amp;amp;zm,"isco08","iscogrp"));
9    %put &amp;amp;=zm2;
ZM2=yrbrn edlvdee isco08 blgetmg
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Jan 2019 14:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524562#M6800</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-01-04T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524567#M6801</link>
      <description>&lt;P&gt;Guru, Nice example to understand how tokenisation works especially when literal tokens are processed&amp;nbsp; by the word scanner , then resolved by the macro processor and eventually sent to compiler for execution. Kudos!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 15:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524567#M6801</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-04T15:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524673#M6802</link>
      <description>&lt;P&gt;Could you tell me also how to delete a word from string?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this function then I get an extra space in the variable and I don't want that. Is there any other way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV class="sasSource"&gt;%let zm_obj3 = %sysfunc(transtrn(&amp;amp;zm_obj2,eduyrs,));&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;%put &amp;amp;zm_obj3;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;yrbrn edlvdee&amp;nbsp; hhmmb iscogrp hinctnta rlgdgr rlgdnm stflife domicil inprdsc blgetmg&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 04 Jan 2019 19:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524673#M6802</guid>
      <dc:creator>Margrett</dc:creator>
      <dc:date>2019-01-04T19:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524692#M6803</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184854"&gt;@Margrett&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Could you tell me also how to delete a word from string?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use this function then I get an extra space in the variable and I don't want that. Is there any other way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="sasSource"&gt;%let zm_obj3 = %sysfunc(transtrn(&amp;amp;zm_obj2,eduyrs,));&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;%put &amp;amp;zm_obj3;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;yrbrn edlvdee&amp;nbsp; hhmmb iscogrp hinctnta rlgdgr rlgdnm stflife domicil inprdsc blgetmg&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your target does not include the blank so you are getting what you asked for.&amp;nbsp; You could use COMPBL after TRANSTRN&amp;nbsp;or add a space to the target.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;141  %let zm = yrbrn edlvdee isco08 blgetmg;
142  %let zm2 = %sysfunc(transtrn(&amp;amp;zm,%str(isco08 ),));
143  %put &amp;amp;=zm2;
ZM2=yrbrn edlvdee blgetmg
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm a bit worried that you are doing this macro string manipulation when you should be using different tools.&amp;nbsp; Can you start a new question where you ask a more fundamental question related to your overall goal.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 20:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524692#M6803</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-01-04T20:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524798#M6805</link>
      <description>&lt;PRE&gt;%let zm = yrbrn edlvdee isco08 blgetmg;

%let zm2 = %sysfunc(tranwrd(&amp;amp;zm, isco08, iscogrp));
%put &amp;amp;zm2;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 11:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524798#M6805</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-01-05T11:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: New variable based on old one</title>
      <link>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524835#M6806</link>
      <description>&lt;P&gt;Thank you for your help. I'm doing a project for logistic regression&amp;nbsp;for my university classes. It's more about results than code itself but I wonder how can I automatize the code in few places rather than manually rewrite variables etc. So it is good. I don't need more. Thank you for your time and help. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 20:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/New-variable-based-on-old-one/m-p/524835#M6806</guid>
      <dc:creator>Margrett</dc:creator>
      <dc:date>2019-01-05T20:01:51Z</dc:date>
    </item>
  </channel>
</rss>

