<?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: SAS Studio does not merge file correctly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852972#M337168</link>
    <description>&lt;P&gt;Are you sure that is the data step you used to create the first three observations in that photograph?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data admitDiscount;
  input actlevel $ DisRate;
datalines;
HIGH 0.85
MOD 0.95
LOW 1.0
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because that data step would NOT truncate the strings to just the first three characters like your printout is showing.&lt;/P&gt;
&lt;P&gt;Perhaps the variable the&amp;nbsp; ACTLEVEL in the ADMIT dataset is defined to be only 4 characters long.&lt;/P&gt;
&lt;P&gt;And perhaps you did something silly like inserting TAB characters into the beginning of each line of the data when you ran your data step to create ADMITDISCOUNT.&lt;/P&gt;
&lt;P&gt;The extra tab would explain why they did not match.&amp;nbsp; The length of 4 characters would explain why HIGH printed as HIG.&amp;nbsp; And the fact that&amp;nbsp;the ASCII code for a tab is '09'x comes before any of H, M or L when sorting would explain why the three extra observations appeared first.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 01:11:03 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-01-10T01:11:03Z</dc:date>
    <item>
      <title>SAS Studio does not merge file correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852970#M337166</link>
      <description>&lt;P&gt;Hello, I tried a simple task to merge two datasets in SAS Studio. One data set is the clinic admittance data (21 observations) in the built-in SASUSER library with SAS BASE. The other data set was created by me (3 observations). I created following to do a simple demonstration of merging to students. It worked well in SAS BASE, but when run in SAS Studio, it generated output as attached. I found two odd things about the output: 1) instead of merging, it's more like SETting the two data sets; 2) actlevel in the created admitDiscount data set has value High printed as Hig. This stays unchanged even with a LENGTH statement before the INPUT in the data step. Any clue and/or suggestions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data admitDiscount; &lt;BR /&gt;input actlevel $ DisRate; &lt;BR /&gt;datalines; &lt;BR /&gt;HIGH 0.85&lt;BR /&gt;MOD 0.95&lt;BR /&gt;LOW 1.0&lt;BR /&gt;; &lt;BR /&gt;proc sort data = admit; by actlevel; &lt;BR /&gt;proc sort data = admitDiscount; by actlevel; run;&amp;nbsp;&lt;BR /&gt;data admit2; &lt;BR /&gt;merge admit admitDis; &lt;BR /&gt;by actlevel; &lt;BR /&gt;newfee = fee*DisRate; &lt;BR /&gt;format newfee 5.2; &lt;BR /&gt;run; &lt;BR /&gt;proc print; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image0.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79205iE3C2105E1F85A5C2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Image0.png" alt="Image0.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 00:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852970#M337166</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2023-01-10T00:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio does not merge file correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852972#M337168</link>
      <description>&lt;P&gt;Are you sure that is the data step you used to create the first three observations in that photograph?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data admitDiscount;
  input actlevel $ DisRate;
datalines;
HIGH 0.85
MOD 0.95
LOW 1.0
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because that data step would NOT truncate the strings to just the first three characters like your printout is showing.&lt;/P&gt;
&lt;P&gt;Perhaps the variable the&amp;nbsp; ACTLEVEL in the ADMIT dataset is defined to be only 4 characters long.&lt;/P&gt;
&lt;P&gt;And perhaps you did something silly like inserting TAB characters into the beginning of each line of the data when you ran your data step to create ADMITDISCOUNT.&lt;/P&gt;
&lt;P&gt;The extra tab would explain why they did not match.&amp;nbsp; The length of 4 characters would explain why HIGH printed as HIG.&amp;nbsp; And the fact that&amp;nbsp;the ASCII code for a tab is '09'x comes before any of H, M or L when sorting would explain why the three extra observations appeared first.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 01:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852972#M337168</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-10T01:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio does not merge file correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852974#M337169</link>
      <description>It's the TAB!!! Thanks for the explanation. The problem fixed. Thank you!!!</description>
      <pubDate>Tue, 10 Jan 2023 01:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852974#M337169</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2023-01-10T01:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio does not merge file correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852975#M337170</link>
      <description>Do you have document or link to share to read more about TAB in SAS Studio programmer and SAS BASE environment? Thanks.</description>
      <pubDate>Tue, 10 Jan 2023 01:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852975#M337170</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2023-01-10T01:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio does not merge file correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852990#M337176</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54106"&gt;@Xin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Do you have document or link to share to read more about TAB in SAS Studio programmer and SAS BASE environment? Thanks.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do not insert TAB characters into program files and your will not have these problems.&lt;/P&gt;
&lt;P&gt;TAB characters do not belong in program files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead in SAS/Studio you can change the preferences to replace tab characters with the spaces needed to move to the next tab stop.&amp;nbsp; Check the option labeled "Substitute spaces for tabs"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1669059317783.png" style="width: 991px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77520i900642598EB102F6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1669059317783.png" alt="Tom_0-1669059317783.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 04:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852990#M337176</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-10T04:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio does not merge file correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852991#M337177</link>
      <description>&lt;P&gt;Also do not indent lines of data.&amp;nbsp; Do yourself a favor and remember to also not indent the DATALINES; (aka CARDS;) statement that starts the block of data lines because the editor has a nasty habit of automatically indenting the next line to match the indent of the line before it.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 04:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Studio-does-not-merge-file-correctly/m-p/852991#M337177</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-10T04:09:35Z</dc:date>
    </item>
  </channel>
</rss>

