<?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 I need to combine 2 raw datasets from permanent library but data has 2 delimiters and missing data in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/I-need-to-combine-2-raw-datasets-from-permanent-library-but-data/m-p/896544#M39886</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Colleen9400_0-1696039356380.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88453i2C71455FEFC5AD4F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Colleen9400_0-1696039356380.png" alt="Colleen9400_0-1696039356380.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been struggling with this homework question for hours and I can't figure it out because the raw data has both * and - as delimiters as well as missing data. We are supposed to combine the raw datasets by the "set" function and maybe the "by" function using the concat or interleaving method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am brand new to this so I can't use a complicated method which I haven't been taught yet. I tried the missover syntax to help with the missing data and it still doesn't work. Also tried DSD and DLM with no success either. this is currently the best I've gotten and as you can see with the output it is completely wrong.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;libname emplib "C:\Users\Colle\Documents\Grad School\A BINF 5210 Health Data Analytics with SAS\Employee Library";

filename F1 "C:\Users\Colle\Documents\Grad School\A BINF 5210 Health Data Analytics with SAS\Employee Library\demo8-1-1.txt";
filename F2 "C:\Users\Colle\Documents\Grad School\A BINF 5210 Health Data Analytics with SAS\Employee Library\demo9-1-1.txt";

data emplib.demo1;
    infile F1 dlm='*-' missover;
    input id gender $ age salary;
run;

proc sort data=emplib.demo1;
    by id;
run;

proc print data=emplib.demo1;
run;

data emplib.demo2;
    infile F2 dlm='*-' missover;
    input id gender $ age salary;
run;

proc sort data=emplib.demo2;
    by id;
run;

proc print data=emplib.demo2;
run;

data emplib.final;
    set emplib.demo1 emplib.demo2;
    by id;
run;

proc print data=emplib.final;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Colleen9400_0-1696041827078.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88454i5E2D6113A8D2F348/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Colleen9400_0-1696041827078.png" alt="Colleen9400_0-1696041827078.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I am also attaching my lecture notes so you can see what I am supposed to be working with or maybe where I am going wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached are both sets of my raw data too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!!&lt;/P&gt;</description>
    <pubDate>Sat, 30 Sep 2023 02:43:55 GMT</pubDate>
    <dc:creator>Colleen9400</dc:creator>
    <dc:date>2023-09-30T02:43:55Z</dc:date>
    <item>
      <title>I need to combine 2 raw datasets from permanent library but data has 2 delimiters and missing data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-need-to-combine-2-raw-datasets-from-permanent-library-but-data/m-p/896544#M39886</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Colleen9400_0-1696039356380.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88453i2C71455FEFC5AD4F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Colleen9400_0-1696039356380.png" alt="Colleen9400_0-1696039356380.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been struggling with this homework question for hours and I can't figure it out because the raw data has both * and - as delimiters as well as missing data. We are supposed to combine the raw datasets by the "set" function and maybe the "by" function using the concat or interleaving method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am brand new to this so I can't use a complicated method which I haven't been taught yet. I tried the missover syntax to help with the missing data and it still doesn't work. Also tried DSD and DLM with no success either. this is currently the best I've gotten and as you can see with the output it is completely wrong.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;libname emplib "C:\Users\Colle\Documents\Grad School\A BINF 5210 Health Data Analytics with SAS\Employee Library";

filename F1 "C:\Users\Colle\Documents\Grad School\A BINF 5210 Health Data Analytics with SAS\Employee Library\demo8-1-1.txt";
filename F2 "C:\Users\Colle\Documents\Grad School\A BINF 5210 Health Data Analytics with SAS\Employee Library\demo9-1-1.txt";

data emplib.demo1;
    infile F1 dlm='*-' missover;
    input id gender $ age salary;
run;

proc sort data=emplib.demo1;
    by id;
run;

proc print data=emplib.demo1;
run;

data emplib.demo2;
    infile F2 dlm='*-' missover;
    input id gender $ age salary;
run;

proc sort data=emplib.demo2;
    by id;
run;

proc print data=emplib.demo2;
run;

data emplib.final;
    set emplib.demo1 emplib.demo2;
    by id;
run;

proc print data=emplib.final;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Colleen9400_0-1696041827078.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88454i5E2D6113A8D2F348/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Colleen9400_0-1696041827078.png" alt="Colleen9400_0-1696041827078.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I am also attaching my lecture notes so you can see what I am supposed to be working with or maybe where I am going wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached are both sets of my raw data too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 02:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-need-to-combine-2-raw-datasets-from-permanent-library-but-data/m-p/896544#M39886</guid>
      <dc:creator>Colleen9400</dc:creator>
      <dc:date>2023-09-30T02:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: I need to combine 2 raw datasets from permanent library but data has 2 delimiters and missing da</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-need-to-combine-2-raw-datasets-from-permanent-library-but-data/m-p/896545#M39887</link>
      <description>&lt;P&gt;The files use THREE delimiters. Can you see what they are?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are using the troublesome old MISSOVER option instead of the modern (30 years old?) TRUNCOVER option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the main thing is you didn't include the DSD option which will allow adjacent delimiters to be seen as indicating a missing value.&amp;nbsp; Without that SAS will treat adjacent delimiters as one.&amp;nbsp; Like it would in a normal file delimited with spaces where users will put in extra spaces to make the columns look neater.&lt;/P&gt;
&lt;PRE&gt;Name  Age Sex
Jane   12  F
Harry   9  M&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look carefully at the requested output.&amp;nbsp; How are the observations ordered?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=c:\downloads ;
filename src ("&amp;amp;path/demo9-1-1.txt","&amp;amp;path/demo8-1-1.txt");

data want;
  infile src dsd dlm=' -*' truncover;
  input Emp_Id $ Gender $ Age Salary;
run;

proc sort;
  by salary;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    Emp_Id    Gender    Age    Salary

  1      19                 90         .
  2      10                 89         .
  3      13        F        78      1000
  4      1         F        45      1000
  5      6         F        67      2000
  6      11        M        67      3000
  7      3                  78      4000
  8      15        F        45      7000
  9      2         F       100     10000
 10      7         M        90     10000
 11      4         F        75     20000
 12      14                 87     40000
 13      20        M        90     50000
 14      21        F        91     70000
&lt;/PRE&gt;
&lt;BR /&gt;Just because the employee ID values LOOK like numbers does not mean you should read them as such.&amp;nbsp; What is the meaning of the MEAN() or MAX() of an ID number?&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 03:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-need-to-combine-2-raw-datasets-from-permanent-library-but-data/m-p/896545#M39887</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-30T03:09:51Z</dc:date>
    </item>
  </channel>
</rss>

