<?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: What is happening at PDV level in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325375#M271406</link>
    <description>Thanks Astounding, but I tried adding length statement as below, but still it was not comming.&lt;BR /&gt;length new_name$ 20.;</description>
    <pubDate>Tue, 17 Jan 2017 17:50:54 GMT</pubDate>
    <dc:creator>a_k93</dc:creator>
    <dc:date>2017-01-17T17:50:54Z</dc:date>
    <item>
      <title>What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325369#M271404</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data ds_test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;retain id name fees;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;length name$ 20.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input id name$ fees;&lt;BR /&gt;datalines;&lt;BR /&gt;1001 aaa 200&lt;BR /&gt;1002 bbb 250&lt;BR /&gt;1003 ccc 180&lt;BR /&gt;1004 ddd 220&lt;BR /&gt;1005 eee 200&lt;BR /&gt;1006 fff 210&lt;BR /&gt;1007 ggg 200&lt;BR /&gt;1008 hhh 200&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1. Data ds_test1;&lt;BR /&gt;2.&amp;nbsp; &amp;nbsp; set ds_test;&lt;BR /&gt;3.&amp;nbsp;&amp;nbsp;&amp;nbsp; if fees = 200 then do;&lt;BR /&gt;4. &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *new_name = catx("", name, "_");&lt;BR /&gt;5. &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_name = strip(name) || strip("_");&lt;BR /&gt;6. &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_name = new_name || "2";&lt;BR /&gt;7. &amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;8. run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The new dataset (ds_test1) which I get after executing the above code contains new_name column. This new column has "_" besides the name variable records which has 200 as fees. I am intentionally adding "2" as shown at line 6 on separate line to further concatinate the new_name variable with value 2 (so that it will looks like "_2"). But It was not concatinating the "2" with "_" as shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default"&gt;&amp;nbsp;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6762i56C78A5494A75C38/image-size/medium?v=v2&amp;amp;px=-1" alt="1.jpg" title="1.jpg" border="0" /&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone tell what is it going at PDV level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;a_k93&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 17:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325369#M271404</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2017-01-17T17:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325372#M271405</link>
      <description>&lt;P&gt;NEW_NAME has a set length in the PDV.&amp;nbsp; It doesn't have room to add "2" to the end of it.&amp;nbsp; The solution is simple though:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_name = strip(new_name) || "2";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 17:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325372#M271405</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-17T17:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325375#M271406</link>
      <description>Thanks Astounding, but I tried adding length statement as below, but still it was not comming.&lt;BR /&gt;length new_name$ 20.;</description>
      <pubDate>Tue, 17 Jan 2017 17:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325375#M271406</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2017-01-17T17:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325377#M271407</link>
      <description>&lt;P&gt;Change you code to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Data ds_test1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;set ds_test;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if fees = 200 then&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt; &amp;nbsp; &amp;nbsp; new_name = catx('_', name,'2');&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 18:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325377#M271407</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-01-17T18:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325382#M271408</link>
      <description>&lt;P&gt;Thanks Shmuel, it does add "_2" to the respected records but the objective of the question was to know why is it not concatinating the way it was coded (in two different lines). Even after specifying length statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 18:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325382#M271408</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2017-01-17T18:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325383#M271409</link>
      <description>&lt;P&gt;Anything wrong with:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;new_name = cats(&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;name, &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;"_2"&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;or &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;new_name = cats(name,"_");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;new_name = cats(new_name,"2");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Did you run with&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;new_name = new_name || &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;"2"&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;or &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;new_name = strip(new_name) || &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;"2"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;In the first use of var || 2 doesn't do what you want because the existing value of new_name is using all of the space allocated for new_name and tacking 2 on the end exceeds the length. It will not matter how long you make it as long as you use two steps to concatenate things.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;The second, using Strip() says to ignore existing blanks on the ends of new_name and then add the '2'.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 18:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325383#M271409</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-17T18:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325387#M271410</link>
      <description>&lt;P&gt;Right, a LENGTh statement will not help.&amp;nbsp; If NEW_NAME has a length of 20, this statement tries to add a 21st character:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_name = new_name || "2";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There just isn't room.&amp;nbsp; That's why you need to remove the trailing blanks from new_name.&amp;nbsp; There are a variety of ways to do that ... the STRIP function is just one way.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 18:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325387#M271410</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-17T18:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325395#M271411</link>
      <description>&lt;P&gt;I can't recall seeing it documented, but the following test shows what is going on:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data ds_test;&lt;BR /&gt;&amp;nbsp; retain id name fees;&lt;BR /&gt;&amp;nbsp; length name$ 20.;&lt;BR /&gt;&amp;nbsp; input id name$ fees;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;1001 aaa 200&lt;BR /&gt;1002 bbb 250&lt;BR /&gt;1003 ccc 180&lt;BR /&gt;1004 ddd 220&lt;BR /&gt;1005 eee 200&lt;BR /&gt;1006 fff 210&lt;BR /&gt;1007 ggg 200&lt;BR /&gt;1008 hhh 200&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data ds_test1;&lt;BR /&gt;&amp;nbsp; set ds_test;&lt;BR /&gt;&amp;nbsp; if fees = 200 then do;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; new_name = strip(name) || "__";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; new_name = strip(new_name) ||"2";&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; else new_name = strip(name) || "_____";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data ds_test2;&lt;BR /&gt;&amp;nbsp; set ds_test;&lt;BR /&gt;&amp;nbsp; if fees = 200 then do;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; new_name = strip(name) || "_";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; new_name = strip(new_name) ||"2";&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; else new_name = strip(name) || "_____";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In creating ds_test, the retain statement determines the order of the variables, plus changes the step functionality but, since no data is missing, the change doesn't have a noticeable effect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When new_name is first created, its length becomes that of the name variable, plus the length of what is being concatenated. Any additional concatenation has no effect on the variable's length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus, for ds_test1 the length becomes 22, but for ds_test2 it becomes 21.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 18:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325395#M271411</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-17T18:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325403#M271412</link>
      <description>Thanks ballardw.... got your point. So just to confirm when SAS execute the below statement&lt;BR /&gt;new_name = strip(name) || "_";&lt;BR /&gt;it allocates all of the space even though the actual content is only 4 characters (aaa_) and hence in the next statement when it tries to concatenate "2" with "aaa_" it does not find the space. It that what you are trying to explain correct?</description>
      <pubDate>Tue, 17 Jan 2017 18:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325403#M271412</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2017-01-17T18:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: What is happening at PDV level</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325767#M271413</link>
      <description>&lt;P&gt;Thanks everybody for the explanation... appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 18:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-happening-at-PDV-level/m-p/325767#M271413</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2017-01-18T18:55:05Z</dc:date>
    </item>
  </channel>
</rss>

