<?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: VARIABLE NOT FOUND in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573687#M12552</link>
    <description>&lt;P&gt;Missing a RUN statement is normally not that big a deal.&amp;nbsp; If you are running the code interactively and forget the RUN (or QUIT for the procs that need that instead) on the LAST procedure or data step then just that step won't until you finish defining it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely if it seems to not run any code you submit then you have given it unbalanced quotes (or possibly other things like parentheses or macro definitions) and it is just waiting for you to close them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can sometimes recover from that state, but restarting is usually the surest way to get back to a stable state.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2019 20:32:51 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-07-15T20:32:51Z</dc:date>
    <item>
      <title>VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573431#M12497</link>
      <description>&lt;P&gt;Hey, so I'm trying to learn SAS from this book called 'Master SAS for data analytics'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm stuck with a proposed exercise (Chapter 6, fourth Hands-on example) exercise within this book and I'd appreciate if any of you could help me with it.&amp;nbsp; Here it goes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA MYSASLIB.CLEANED;SET MYSASLIB.MESSYDATA;&lt;/P&gt;&lt;P&gt;LABEL&lt;BR /&gt;EDUCATION='Years of Schooling'&lt;BR /&gt;HOW_ARRIVED='How Arrived at Clinic'&lt;BR /&gt;TOP_REASON='Top Reason for Coming'&lt;BR /&gt;SATISFACTION='Satisfaction Score'&lt;BR /&gt;Subject="Subject ID"&lt;BR /&gt;DateArrived="Date Arrived"&lt;BR /&gt;TimeArrive="Time Arrived"&lt;BR /&gt;DateLeft="Date Left"&lt;BR /&gt;TimeLeft="Time Left"&lt;BR /&gt;Married="Married?"&lt;BR /&gt;Single="Single?"&lt;BR /&gt;Age="Age Jan 1, 2014"&lt;BR /&gt;Gender="Gender"&lt;BR /&gt;Race="Race"&lt;BR /&gt;Satisfaction="Satisfaction Score";&lt;BR /&gt;TEMP=ARRIVAL;&lt;BR /&gt;DROP ARRIVAL;&lt;BR /&gt;LABEL TEMP='Arrival Temperature';&lt;/P&gt;&lt;P&gt;*****************************************************************STEP 5;&lt;/P&gt;&lt;P&gt;FORMAT ARRIVEDT DATETIME18.;&lt;BR /&gt;FORMAT DATEARRIVED2 DATE10. TIMEARRIVET TIME8.;&lt;BR /&gt;DATEARRIVED2=INPUT(TRIM(DATEARRIVED),MMDDYY10.);&lt;BR /&gt;I= FIND(TIMEARRIVE," ");&lt;BR /&gt;P=FIND(TIMEARRIVE,"P");&lt;BR /&gt;TIMEARRIVE2=SUBSTR(TIMEARRIVE,1,I-1);&lt;BR /&gt;TIMEARRIVET=INPUT(TRIM(TIMEARRIVE2),TIME8.);&lt;BR /&gt;IF P&amp;gt;0 THEN TIMEARRIVET=TIMEARRIVET+43200;&lt;BR /&gt;ARRIVEDT=DHMS(DATEARRIVED2,0,0,TIMEARRIVET) ;&lt;/P&gt;&lt;P&gt;Label ARRIVEDT="Date &amp;amp; Time Arrived";&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;*****************************************************************STEP 6;&lt;BR /&gt;FORMAT LEFT_DT DATETIME18.;&lt;BR /&gt;FORMAT DATELEFT_2 DATE10. TIMELEFT_T TIME8.;&lt;BR /&gt;DATELEFT_2 = INPUT(TRIM(DATELEFT), MMDDYY10.);&lt;BR /&gt;K = FIND(TIMELEFT, ' ');&lt;BR /&gt;L= FIND(TIMELEFT, 'P');&lt;/P&gt;&lt;P&gt;TIMELEFT_2= SUBSTR(TIMELEFT, 1, K-1);&lt;BR /&gt;TIMELEFT_T=INPUT(TRIM(TIMELEFT_2), TIME8.,);&lt;/P&gt;&lt;P&gt;IF L&amp;gt;0 THEN TIMELEFT_T=TIMELEFT_T+43200;&lt;BR /&gt;LEFT_DT=DHMS(TIMELEFT_2,0,0, TIMELEFT_T);&lt;/P&gt;&lt;P&gt;LABEL LEFT_DT = 'Date &amp;amp; Time arrived';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;PROC PRINT LABEL&lt;BR /&gt;DATA=MYSASLIB.CLEANED&lt;BR /&gt;(firstobs=1 obs=30);&lt;BR /&gt;var SUBJEcT ARRIVEDT TIMELEFT DATELEFT DATELEFT_2 TIMELEFT_T;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the book has the code up to STEP 5 - The others steps are irrelevant to my question so I cut 'em out - and when I execute it, it runs smoothly. The exercise asks me to replicate shown in STEP 5, which would be my STEP 6, but when I try to do it, it keeps bugging.&lt;/P&gt;&lt;P&gt;The log box displays:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;4583 DATA=MYSASLIB.CLEANED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;4584 (firstobs=1 obs=30);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;4585 var SUBJEcT ARRIVEDT TIMELEFT DATELEFT DATELEFT_2 TIMELEFT_T;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;ERROR: Variable DATELEFT_2 not found.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;ERROR: Variable TIMELEFT_T not found.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;4586 RUN;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;And I don't understand why those variables aren't defined, if supposedly I'm just replicating STEP 5. There must be something that I'm overlooking.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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-center" image-alt="Captura1.JPG" style="width: 560px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31039iBCC975F111A74BE8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura1.JPG" alt="Captura1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I attached the above image, so it's clearer what they meant to do in STEP 5 and of course what I'm trying to copy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 05:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573431#M12497</guid>
      <dc:creator>Franrua</dc:creator>
      <dc:date>2019-07-15T05:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573434#M12498</link>
      <description>&lt;P&gt;Welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Please show us the code you wrote. Not only what the log says&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 05:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573434#M12498</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-15T05:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573437#M12500</link>
      <description>&lt;P&gt;The last ERROR is always the least important. Debug your code top-down, because fixing the first problem might do away with all the others.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*****************************************************************STEP 5;

FORMAT ARRIVEDT DATETIME18.;
FORMAT DATEARRIVED2 DATE10. TIMEARRIVET TIME8.;
DATEARRIVED2=INPUT(TRIM(DATEARRIVED),MMDDYY10.);
I= FIND(TIMEARRIVE," ");
P=FIND(TIMEARRIVE,"P");
TIMEARRIVE2=SUBSTR(TIMEARRIVE,1,I-1);
TIMEARRIVET=INPUT(TRIM(TIMEARRIVE2),TIME8.);
IF P&amp;gt;0 THEN TIMEARRIVET=TIMEARRIVET+43200;
ARRIVEDT=DHMS(DATEARRIVED2,0,0,TIMEARRIVET) ;

Label ARRIVEDT="Date &amp;amp; Time Arrived";
RUN; /* This statement ends your data step and causes the following code to be invalid */

*****************************************************************STEP 6;
FORMAT LEFT_DT DATETIME18.;
FORMAT DATELEFT_2 DATE10. TIMELEFT_T TIME8.;
DATELEFT_2 = INPUT(TRIM(DATELEFT), MMDDYY10.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jul 2019 05:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573437#M12500</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-15T05:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573439#M12501</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;It is already there!&amp;nbsp; What I wrote is from STEP 6 (including) downward.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 05:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573439#M12501</guid>
      <dc:creator>Franrua</dc:creator>
      <dc:date>2019-07-15T05:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573442#M12504</link>
      <description>&lt;P&gt;MIster, I don't know if debugging from the top would help because, as I said, the code was already in the SAS file I opened. The part that I wrote, which is causing these bugs, starts in STEP 6.&lt;/P&gt;&lt;P&gt;I attach the whole code.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 05:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573442#M12504</guid>
      <dc:creator>Franrua</dc:creator>
      <dc:date>2019-07-15T05:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573446#M12506</link>
      <description>&lt;P&gt;Go look for the FIRST ERROR in the log, not the last. You posted the log from the final proc print only, but your problems start with the FIRST statement you added, because that comes after a&amp;nbsp;&lt;EM&gt;finished&lt;/EM&gt; data step and is invalid, as it has to be&amp;nbsp;&lt;EM&gt;in&lt;/EM&gt; a data step and not in "open code".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I mean by top-down:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;start at the top of the log&lt;/LI&gt;
&lt;LI&gt;scroll down till you find the first ERROR/WARNING&lt;/LI&gt;
&lt;LI&gt;fix that&lt;/LI&gt;
&lt;LI&gt;rerun the code&lt;/LI&gt;
&lt;LI&gt;if there are still problems, repeat the process&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Never assume that code you got from elsewhere will simply run. The code may me bogus as such, or fail because it comes from a different environment or makes assumptions.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 06:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573446#M12506</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-15T06:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573447#M12507</link>
      <description>2 errors ...&lt;BR /&gt;&lt;BR /&gt;The code you added should become part of the existing long DATA step.  So remove the RUN statement just before your additions.&lt;BR /&gt;&lt;BR /&gt;Second, the long line of asterisks that you added needs a semicolon at the end of it.  Otherwise it becomes a comment statement that comments out the PROC PRINT statement that follows.</description>
      <pubDate>Mon, 15 Jul 2019 07:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573447#M12507</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-07-15T07:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573581#M12534</link>
      <description>&lt;P&gt;1. Format your code. Then it becomes quite easy to see where the issues may be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA MYSASLIB.CLEANED;
	SET MYSASLIB.MESSYDATA;
	LABEL EDUCATION='Years of Schooling' HOW_ARRIVED='How Arrived at Clinic' 
		TOP_REASON='Top Reason for Coming' SATISFACTION='Satisfaction Score' 
		Subject="Subject ID" DateArrived="Date Arrived" TimeArrive="Time Arrived" 
		DateLeft="Date Left" TimeLeft="Time Left" Married="Married?" Single="Single?" 
		Age="Age Jan 1, 2014" Gender="Gender" Race="Race" 
		Satisfaction="Satisfaction Score";
	TEMP=ARRIVAL;
	DROP ARRIVAL;
	LABEL TEMP='Arrival Temperature';
	*****************************************************************STEP 5;
	FORMAT ARRIVEDT DATETIME18.;
	FORMAT DATEARRIVED2 DATE10. TIMEARRIVET TIME8.;
	DATEARRIVED2=INPUT(TRIM(DATEARRIVED), MMDDYY10.);
	I=FIND(TIMEARRIVE, " ");
	P=FIND(TIMEARRIVE, "P");
	TIMEARRIVE2=SUBSTR(TIMEARRIVE, 1, I-1);
	TIMEARRIVET=INPUT(TRIM(TIMEARRIVE2), TIME8.);

	IF P&amp;gt;0 THEN
		TIMEARRIVET=TIMEARRIVET+43200;
	ARRIVEDT=DHMS(DATEARRIVED2, 0, 0, TIMEARRIVET);
	Label ARRIVEDT="Date &amp;amp; Time Arrived"; &lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;*would recommend single quotes here otherwise the &amp;amp; may cause an issue;
RUN;&lt;/FONT&gt;&lt;/STRONG&gt;

*****************************************************************STEP 6;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;*WHICH DATA SET IS THIS APPLIED TO? THE run above terminated your data step, you either need &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;a new DATA and SET or you need to remove the previous RUN;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;
&lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;FORMAT LEFT_DT DATETIME18.;&lt;/STRONG&gt;&lt;/FONT&gt;
FORMAT DATELEFT_2 DATE10. TIMELEFT_T TIME8.;
DATELEFT_2=INPUT(TRIM(DATELEFT), MMDDYY10.);
K=FIND(TIMELEFT, ' ');
L=FIND(TIMELEFT, 'P');
TIMELEFT_2=SUBSTR(TIMELEFT, 1, K-1);
TIMELEFT_T=INPUT(TRIM(TIMELEFT_2), TIME8., );
IF L&amp;gt;0 THEN TIMELEFT_T=TIMELEFT_T+43200;
LEFT_DT=DHMS(TIMELEFT_2, 0, 0, TIMELEFT_T);
LABEL LEFT_DT='Date &amp;amp; Time arrived';
RUN;
*********************************************************************

PROC PRINT LABEL
DATA=MYSASLIB.CLEANED
(firstobs=1 obs=30);
var SUBJEcT ARRIVEDT TIMELEFT DATELEFT DATELEFT_2 TIMELEFT_T;
RUN;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281536"&gt;@Franrua&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hey, so I'm trying to learn SAS from this book called 'Master SAS for data analytics'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm stuck with a proposed exercise (Chapter 6, fourth Hands-on example) exercise within this book and I'd appreciate if any of you could help me with it.&amp;nbsp; Here it goes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA MYSASLIB.CLEANED;SET MYSASLIB.MESSYDATA;&lt;/P&gt;
&lt;P&gt;LABEL&lt;BR /&gt;EDUCATION='Years of Schooling'&lt;BR /&gt;HOW_ARRIVED='How Arrived at Clinic'&lt;BR /&gt;TOP_REASON='Top Reason for Coming'&lt;BR /&gt;SATISFACTION='Satisfaction Score'&lt;BR /&gt;Subject="Subject ID"&lt;BR /&gt;DateArrived="Date Arrived"&lt;BR /&gt;TimeArrive="Time Arrived"&lt;BR /&gt;DateLeft="Date Left"&lt;BR /&gt;TimeLeft="Time Left"&lt;BR /&gt;Married="Married?"&lt;BR /&gt;Single="Single?"&lt;BR /&gt;Age="Age Jan 1, 2014"&lt;BR /&gt;Gender="Gender"&lt;BR /&gt;Race="Race"&lt;BR /&gt;Satisfaction="Satisfaction Score";&lt;BR /&gt;TEMP=ARRIVAL;&lt;BR /&gt;DROP ARRIVAL;&lt;BR /&gt;LABEL TEMP='Arrival Temperature';&lt;/P&gt;
&lt;P&gt;*****************************************************************STEP 5;&lt;/P&gt;
&lt;P&gt;FORMAT ARRIVEDT DATETIME18.;&lt;BR /&gt;FORMAT DATEARRIVED2 DATE10. TIMEARRIVET TIME8.;&lt;BR /&gt;DATEARRIVED2=INPUT(TRIM(DATEARRIVED),MMDDYY10.);&lt;BR /&gt;I= FIND(TIMEARRIVE," ");&lt;BR /&gt;P=FIND(TIMEARRIVE,"P");&lt;BR /&gt;TIMEARRIVE2=SUBSTR(TIMEARRIVE,1,I-1);&lt;BR /&gt;TIMEARRIVET=INPUT(TRIM(TIMEARRIVE2),TIME8.);&lt;BR /&gt;IF P&amp;gt;0 THEN TIMEARRIVET=TIMEARRIVET+43200;&lt;BR /&gt;ARRIVEDT=DHMS(DATEARRIVED2,0,0,TIMEARRIVET) ;&lt;/P&gt;
&lt;P&gt;Label ARRIVEDT="Date &amp;amp; Time Arrived";&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;*****************************************************************STEP 6;&lt;BR /&gt;FORMAT LEFT_DT DATETIME18.;&lt;BR /&gt;FORMAT DATELEFT_2 DATE10. TIMELEFT_T TIME8.;&lt;BR /&gt;DATELEFT_2 = INPUT(TRIM(DATELEFT), MMDDYY10.);&lt;BR /&gt;K = FIND(TIMELEFT, ' ');&lt;BR /&gt;L= FIND(TIMELEFT, 'P');&lt;/P&gt;
&lt;P&gt;TIMELEFT_2= SUBSTR(TIMELEFT, 1, K-1);&lt;BR /&gt;TIMELEFT_T=INPUT(TRIM(TIMELEFT_2), TIME8.,);&lt;/P&gt;
&lt;P&gt;IF L&amp;gt;0 THEN TIMELEFT_T=TIMELEFT_T+43200;&lt;BR /&gt;LEFT_DT=DHMS(TIMELEFT_2,0,0, TIMELEFT_T);&lt;/P&gt;
&lt;P&gt;LABEL LEFT_DT = 'Date &amp;amp; Time arrived';&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;*********************************************************************&lt;/P&gt;
&lt;P&gt;PROC PRINT LABEL&lt;BR /&gt;DATA=MYSASLIB.CLEANED&lt;BR /&gt;(firstobs=1 obs=30);&lt;BR /&gt;var SUBJEcT ARRIVEDT TIMELEFT DATELEFT DATELEFT_2 TIMELEFT_T;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the book has the code up to STEP 5 - The others steps are irrelevant to my question so I cut 'em out - and when I execute it, it runs smoothly. The exercise asks me to replicate shown in STEP 5, which would be my STEP 6, but when I try to do it, it keeps bugging.&lt;/P&gt;
&lt;P&gt;The log box displays:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;4583 DATA=MYSASLIB.CLEANED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;4584 (firstobs=1 obs=30);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;4585 var SUBJEcT ARRIVEDT TIMELEFT DATELEFT DATELEFT_2 TIMELEFT_T;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;ERROR: Variable DATELEFT_2 not found.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;ERROR: Variable TIMELEFT_T not found.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;4586 RUN;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;And I don't understand why those variables aren't defined, if supposedly I'm just replicating STEP 5. There must be something that I'm overlooking.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-center" image-alt="Captura1.JPG" style="width: 560px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31039iBCC975F111A74BE8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura1.JPG" alt="Captura1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I attached the above image, so it's clearer what they meant to do in STEP 5 and of course what I'm trying to copy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 16:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573581#M12534</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-15T16:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573683#M12551</link>
      <description>&lt;P&gt;Thanks, I think this kind of helped me to sort it out.&lt;/P&gt;&lt;P&gt;As suggested by you and other people, I misplaced the RUN statement in the DATA step, so I rearranged it as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FORMAT ARRIVEDT DATETIME18.;&lt;BR /&gt;FORMAT DATEARRIVED2 DATE10. TIMEARRIVET TIME8.;&lt;BR /&gt;DATEARRIVED2=INPUT(TRIM(DATEARRIVED),MMDDYY10.);&lt;BR /&gt;I= FIND(TIMEARRIVE," ");&lt;BR /&gt;P=FIND(TIMEARRIVE,"P");&lt;BR /&gt;TIMEARRIVE2=SUBSTR(TIMEARRIVE,1,I-1);&lt;BR /&gt;TIMEARRIVET=INPUT(TRIM(TIMEARRIVE2),TIME8.);&lt;BR /&gt;IF P&amp;gt;0 THEN TIMEARRIVET=TIMEARRIVET+43200;&lt;BR /&gt;ARRIVEDT=DHMS(DATEARRIVED2,0,0,TIMEARRIVET) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LABEL ARRIVEDT='Date &amp;amp; Time Arrived';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FORMAT LEFT_DT DATETIME18.;&lt;BR /&gt;FORMAT DATELEFT_2 DATE10. TIMELEFT_T TIME8.;&lt;BR /&gt;DATELEFT_2 = INPUT(TRIM(DATELEFT), MMDDYY10.);&lt;BR /&gt;K = FIND(TIMELEFT, ' ');&lt;BR /&gt;L= FIND(TIMELEFT, 'P');&lt;BR /&gt;TIMELEFT_2= SUBSTR(TIMELEFT, 1, K-1);&lt;BR /&gt;TIMELEFT_T=INPUT(TRIM(TIMELEFT_2), TIME8.);&lt;/P&gt;&lt;P&gt;IF L&amp;gt;0 THEN TIMELEFT_T=TIMELEFT_T+43200;&lt;BR /&gt;LEFT_DT=DHMS(DATELEFT_2,0,0, TIMELEFT_T);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LABEL LEFT_DT = 'Date &amp;amp; Time arrived';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the above worked ONLY after I closed the SAS session and reopened it.&lt;/P&gt;&lt;P&gt;I've got a vague idea of what it might've caused, but I'm unsure. The aforementioned book approached the QUIT and RUN statement and stated the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;"If you fail to include a RUN statement at the end of your SAS job (or if SAS runs into an&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;error and never sees the RUN statement), the SAS processor may continue to run in the&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;background. This can cause unpredictable problems. If this occurs, press Ctrl-Break.&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;An option will appear allowing you to “Cancel Submitted Statements"&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Similarly, knowing that when a SAS session is ended and all of the statements therein are therefore cancelled, lead me to believe that the error was somehow related with the RUN statement, since it was, to some extent, my most blatant mistake.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Do you really think it had to do anything with it or I'm completely lost?&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;P.D: sorry for my English. &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 20:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573683#M12551</guid>
      <dc:creator>Franrua</dc:creator>
      <dc:date>2019-07-15T20:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: VARIABLE NOT FOUND</title>
      <link>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573687#M12552</link>
      <description>&lt;P&gt;Missing a RUN statement is normally not that big a deal.&amp;nbsp; If you are running the code interactively and forget the RUN (or QUIT for the procs that need that instead) on the LAST procedure or data step then just that step won't until you finish defining it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely if it seems to not run any code you submit then you have given it unbalanced quotes (or possibly other things like parentheses or macro definitions) and it is just waiting for you to close them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can sometimes recover from that state, but restarting is usually the surest way to get back to a stable state.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 20:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/VARIABLE-NOT-FOUND/m-p/573687#M12552</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-15T20:32:51Z</dc:date>
    </item>
  </channel>
</rss>

