<?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: missing my observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260297#M50484</link>
    <description>&lt;P&gt;I tried to switch out keep and it still did not work&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2016 02:39:50 GMT</pubDate>
    <dc:creator>stancemcgraw</dc:creator>
    <dc:date>2016-03-31T02:39:50Z</dc:date>
    <item>
      <title>missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260288#M50480</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I input the following code in order to merge some tables together, but then it says I have 37 variables and zero obervations. &amp;nbsp;Where did all my observations go?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;WARNING: Multiple lengths were specified for the variable TICI_Scale by input data set(s). This may cause truncation of data.&lt;/P&gt;
&lt;P&gt;NOTE: There were 380 observations read from the data set IAT.TIMETOIAT.&lt;/P&gt;
&lt;P&gt;NOTE: There were 2767 observations read from the data set IAT.NB1213D.&lt;/P&gt;
&lt;P&gt;NOTE: There were 1410 observations read from the data set IAT.NB14B.&lt;/P&gt;
&lt;P&gt;NOTE: There were 397 observations read from the data set IAT.NB15B.&lt;/P&gt;
&lt;P&gt;NOTE: The data set IAT.TIMETOIAT4 has 0 observations and 37 variables.&lt;/P&gt;
&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.11 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.06 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Iat '\\vmware-host\Shared Folders\Desktop\SAS\IAT\';
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;&amp;nbsp;
&amp;nbsp;proc import datafile="Z:\Desktop\SAS\IAT\timetoiat"
&amp;nbsp;out=Iat.timetoiat dbms=xlsx replace;
&amp;nbsp;sheet="Sheet1";
&amp;nbsp;getnames=yes;
&amp;nbsp;
&amp;nbsp; run;
&amp;nbsp;
&amp;nbsp;
proc import datafile="Z:\Desktop\OneDrive\Documents\Trauma-Research\Time to IAT Study\2012 and 2013 data for research, cleaned.csv"
out=Iat.NB1213 dbms=csv replace;&amp;nbsp;
guessingrows=4000;
getnames=yes;&amp;nbsp;
run;
&amp;nbsp;
&amp;nbsp;
data iat.nb1213b; &lt;BR /&gt;set iat.nb1213 (keep= stroke_id nihssdc mrdc dcdisp iatype nihssinitial); &lt;BR /&gt;retain stroke_id2;
&amp;nbsp;
if stroke_id = '' &lt;BR /&gt;and nihssdc = . &lt;BR /&gt;and mrdc = . &lt;BR /&gt;and dcdisp = '' &lt;BR /&gt;and iatype = '' &lt;BR /&gt;and nihssinitial = . &lt;BR /&gt;    then delete;
&amp;nbsp;
drop stroke_id2;
&amp;nbsp;
if stroke_id NE '' then stroke_id2 = stroke_id;
else stroke_id = stroke_id2;
run;
&amp;nbsp;
&amp;nbsp;
proc sort data = iat.nb1213b; &lt;BR /&gt;by stroke_id; &lt;BR /&gt;run;
&lt;BR /&gt;proc transpose data = iat.nb1213b out=iat.nb1213c (drop=_name_) prefix=iatype;
by stroke_id;
var iatype;
run;
&amp;nbsp;
&amp;nbsp;&amp;nbsp;
data iat.nb1213d; &lt;BR /&gt;merge iat.nb1213b (in=test) iat.nb1213c;&amp;nbsp;
by stroke_id;&amp;nbsp;
drop iatype;
&amp;nbsp;
if first.stroke_id then output;
&amp;nbsp;
run;
&amp;nbsp;
proc import datafile="Z:\Desktop\OneDrive\Documents\Trauma-Research\Time to IAT Study\2014 Neurobase data cleaned.csv"
out=Iat.NB14 dbms=csv replace;&amp;nbsp;
guessingrows=4000;
getnames=yes;&amp;nbsp;
run;
&amp;nbsp;
data iat.nb14b; &lt;BR /&gt;set iat.nb14 (keep=&amp;nbsp; stroke_id nihssdc mrdc dcdisp TICI_scale CTfirstslicetoneedle groinpuncturetorecantime symptom_arrival nihssinitial); &lt;BR /&gt;retain stroke_id2;
&amp;nbsp;
if stroke_id = '' &lt;BR /&gt;and nihssdc = . &lt;BR /&gt;and mrdc = . &lt;BR /&gt;and dcdisp = '' &lt;BR /&gt;and TICI_scale = '' &lt;BR /&gt;and CTfirstslicetoneedle = . &lt;BR /&gt;and groinpuncturetorecantime = . &lt;BR /&gt;and symptom_arrival = .
and nihssinitial = . &lt;BR /&gt;    then delete;
&amp;nbsp;
drop stroke_id2;
&amp;nbsp;
if stroke_id NE '' then stroke_id2 = stroke_id;
else stroke_id = stroke_id2;
&amp;nbsp;
run;&lt;BR /&gt;
proc sort data = iat.nb14b; &lt;BR /&gt;by stroke_id; &lt;BR /&gt;run;&amp;nbsp;&lt;BR /&gt;
data iat.nb1213d; &lt;BR /&gt;merge iat.nb1213b (in=test)&amp;nbsp; iat.nb1213c;&amp;nbsp;
by stroke_id;&amp;nbsp;
drop iatype;
if first.stroke_id then output;
&amp;nbsp;
run;&lt;BR /&gt;
proc import datafile="Z:\Desktop\OneDrive\Documents\Trauma-Research\Time to IAT Study\2015 Neurobase data cleaned.csv"
out=Iat.NB15 dbms=csv replace;&amp;nbsp;
guessingrows=4000;
getnames=yes;&amp;nbsp;
run;
&amp;nbsp;
data iat.nb15b; &lt;BR /&gt;set iat.nb15 (keep=&amp;nbsp; stroke_id nihssdc nihssinitial mrdc dcdisp TICI_scale CTfirstslicetoneedle groinpuncturetorecantime symptom_arrival); &lt;BR /&gt;retain stroke_id2;
&amp;nbsp;
if stroke_id = '' &lt;BR /&gt;and nihssdc = . &lt;BR /&gt;and mrdc = . &lt;BR /&gt;and dcdisp = '' &lt;BR /&gt;and TICI_scale = '' &lt;BR /&gt;and CTfirstslicetoneedle = . &lt;BR /&gt;and groinpuncturetorecantime = . &lt;BR /&gt;and symptom_arrival = .&amp;nbsp;
and nihssinitial = . &lt;BR /&gt;    then delete;
&lt;BR /&gt;drop stroke_id2;
&amp;nbsp;
if stroke_id NE '' then stroke_id2 = stroke_id;
else stroke_id = stroke_id2;
run;
&amp;nbsp;
proc sort data = iat.nb15b; by stroke_id; run;
proc sort data = iat.nb14b; by stroke_id; run;
proc sort data = iat.nb1213d; by stroke_id; run;
proc sort data=iat.timetoiat; by strokeid;run;
&amp;nbsp;
data iat.timetoiat4; &lt;BR /&gt;merge iat.timetoiat (in=keep rename=(strokeid=stroke_id)) iat.nb1213d iat.nb14b iat.nb15b;
by stroke_id;&lt;BR /&gt;
if keep2 NE 1 then delete;
else keep2=keep;
run;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 02:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260288#M50480</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2016-03-31T02:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260290#M50481</link>
      <description>&lt;P&gt;Sorry - it appears the browser unformats the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code you're using a variable KEEP2 but it doesn't appear to have been created anywhere. Did you mean to reference KEEP, from IN=KEEP?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, since KEEP is a keyword in SAS I would recommend using a different name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 02:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260290#M50481</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T02:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260297#M50484</link>
      <description>&lt;P&gt;I tried to switch out keep and it still did not work&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 02:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260297#M50484</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2016-03-31T02:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260300#M50485</link>
      <description>&lt;P&gt;What happens if you run the following? Please include the log if you get errors - the full log including the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data iat.timetoiat4; 
merge iat.timetoiat (rename=(strokeid=stroke_id)) 
iat.nb1213d 
iat.nb14b
iat.nb15b;

by stroke_id;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260300#M50485</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T03:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260303#M50486</link>
      <description>&lt;P&gt;Also, what are you expecting to happen here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop stroke_id2;
 
if stroke_id NE '' then stroke_id2 = stroke_id;
else stroke_id = stroke_id2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since you drop stroke_id2 then it's the equivalent of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop stroke_id2;
 
if stroke_id eq '' then stroke_id = stroke_id2;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260303#M50486</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T03:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260304#M50487</link>
      <description>&lt;P&gt;I don't get errors, but it does not read in all the data i need from the table timeiat. &amp;nbsp;There is a lot missing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Multiple lengths were specified for the variable TICI_Scale by input data set(s). This may cause truncation of data.&lt;/P&gt;&lt;P&gt;NOTE: There were 380 observations read from the data set IAT.TIMETOIAT.&lt;/P&gt;&lt;P&gt;NOTE: There were 2767 observations read from the data set IAT.NB1213D.&lt;/P&gt;&lt;P&gt;NOTE: There were 1410 observations read from the data set IAT.NB14B.&lt;/P&gt;&lt;P&gt;NOTE: There were 397 observations read from the data set IAT.NB15B.&lt;/P&gt;&lt;P&gt;NOTE: The data set IAT.TIMETOIAT4 has 4652 observations and 36 variables.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.09 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.07 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260304#M50487</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2016-03-31T03:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260305#M50488</link>
      <description>&lt;P&gt;This implies&amp;nbsp;it's not a technical error - it's a logical error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately this means we can only guess and that you need to figure out what's going on. I also don't know what you mean by missing here. Are you missing rows, or missing values for a specific variable? Missing variables entirely?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally you post data that replicates your issue, but with 4 datasets it gets cumbersome. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some idea's here on how to check that your merge is happening correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/How-to-check-if-merge-happened-correctly-in-sas-and-things-to/m-p/259755/highlight/true#M50291" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/How-to-check-if-merge-happened-correctly-in-sas-and-things-to/m-p/259755/highlight/true#M50291&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some things I would try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Verify all the input datasets are the way you want&lt;/P&gt;
&lt;P&gt;2. Start by merging two data sets, does this give you what you want? If not, what do you need to change.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260305#M50488</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T03:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260307#M50490</link>
      <description>&lt;P&gt;I'm missing ots of observations for variables, but not variables&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260307#M50490</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2016-03-31T03:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260308#M50491</link>
      <description>&lt;P&gt;You'll have to trace the data to figure out why they're missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's one way to start doing it, add in an indicator to determine which records come from where. Identify one of your 'missing' observations and trace back from which data set is missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your assumption that all data should be in all 4 datasets or will some datasets have some ID's and others have some? Also, I'm assuming that you're not doing a many to many merge - ie you have multiple records for your BY variable in any two of your datasets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beyond this, without data, I can't help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data iat.timetoiat4; 
merge iat.timetoiat (rename=(strokeid=stroke_id) in=D1) 
iat.nb1213d (in=D2)
iat.nb14b (in=D3)
iat.nb15b (in=D4);

by stroke_id;

SD1=D1;
SD2=D2;
SD3=D3;
SD4=D4;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:22:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260308#M50491</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T03:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260312#M50493</link>
      <description>&lt;P&gt;Also, run a proc contents on each input dataset and make sure the length type for the merge variable is the same.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 03:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260312#M50493</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T03:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: missing my observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260327#M50497</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data iat.timetoiat4; 
   merge iat.timetoiat (in=keep rename=(strokeid=stroke_id)) 
   iat.nb1213d 
   iat.nb14b 
   iat.nb15b;
   by stroke_id;

if keep2 NE 1 then delete;
else keep2=keep;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you do not have a variable named KEEP2 prior to here then the variabl is created with a missing value. Since missing is ALWAYS ne 1 then every record is deleted.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 06:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-my-observations/m-p/260327#M50497</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-31T06:52:52Z</dc:date>
    </item>
  </channel>
</rss>

