<?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: Put Input function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457509#M116002</link>
    <description>&lt;P&gt;The error log is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         Libname Review'/folders/myfolders/Review' ;
 NOTE: Libref REVIEW was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/Review
 63         Libname Learn'/folders/myfolders/Learn' ;
 NOTE: Libref LEARN refers to the same physical library as LEARN2.
 NOTE: Libref LEARN was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/Learn
 64         Libname myformat'/folders/myfolders/sasuser.v94' ;
 NOTE: Libref MYFORMAT refers to the same physical library as SASUSER.
 NOTE: Libref MYFORMAT was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/sasuser.v94
 65         Options fmtsearch=(myformat) ;
 66         Options mergenoby=error ;
 67         
 68         proc sort data=learn.demographic2 ;
 69         NumID = Input(ID, 3.) ;
             _____
             180
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 70         by NumID ;
 ERROR: Variable NUMID not found.
 71         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 72         
 
 
 73         proc sort data=learn.survey2 ;
 74         NumID = Input(ID, 3.) ;
             _____
             180
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 75         by NumID ;
 ERROR: Variable NUMID not found.
 76         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 77         
 
 
 78         Data review.Prob10_13 ;
 79         merge learn.demographic2(in=indemographic2)
 80               learn.survey2(in=inSurvey2) ;
 81         by NumID ;
 82         If Indemographic2 InSurvey2 ;
                               _________
                               22
 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, 
               LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  
 
 83         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set REVIEW.PROB10_13 may be incomplete.  When this step was stopped there were 0 observations and 10 variables.
 WARNING: Data set REVIEW.PROB10_13 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 84         
 85         proc print data=review.Prob10_13 noobs ;
 86         run ;
 
 NOTE: There were 9 observations read from the data set REVIEW.PROB10_13.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.11 seconds
       cpu time            0.10 seconds
       
 
 87         
 88         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 101        &lt;/PRE&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Wed, 25 Apr 2018 20:22:59 GMT</pubDate>
    <dc:creator>ManitobaMoose</dc:creator>
    <dc:date>2018-04-25T20:22:59Z</dc:date>
    <item>
      <title>Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457508#M116001</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is generating a ton of errors. I am not sure why the input statement is not correct. The original variable ID is a character and I want to convert it to numeric, and then merge sets. The code is below. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Libname Review'/folders/myfolders/Review' ;
Libname Learn'/folders/myfolders/Learn' ;  
Libname myformat'/folders/myfolders/sasuser.v94' ; 
Options fmtsearch=(myformat) ;
Options mergenoby=error ; 

proc sort data=learn.demographic2 ; 
	NumID = Input(ID, 3.) ;
	by NumID ;
run ; 

proc sort data=learn.survey2 ;  
	NumID = Input(ID, 3.) ;
	by NumID ; 
run ; 

Data review.Prob10_13 ; 
	merge learn.demographic2(in=indemographic2)
	      learn.survey2(in=inSurvey2) ;
	by NumID ; 
	If Indemographic2 InSurvey2 ; 
run ; 

proc print data=review.Prob10_13 noobs ; 
run ; &lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457508#M116001</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-25T20:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457509#M116002</link>
      <description>&lt;P&gt;The error log is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         Libname Review'/folders/myfolders/Review' ;
 NOTE: Libref REVIEW was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/Review
 63         Libname Learn'/folders/myfolders/Learn' ;
 NOTE: Libref LEARN refers to the same physical library as LEARN2.
 NOTE: Libref LEARN was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/Learn
 64         Libname myformat'/folders/myfolders/sasuser.v94' ;
 NOTE: Libref MYFORMAT refers to the same physical library as SASUSER.
 NOTE: Libref MYFORMAT was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/sasuser.v94
 65         Options fmtsearch=(myformat) ;
 66         Options mergenoby=error ;
 67         
 68         proc sort data=learn.demographic2 ;
 69         NumID = Input(ID, 3.) ;
             _____
             180
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 70         by NumID ;
 ERROR: Variable NUMID not found.
 71         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 72         
 
 
 73         proc sort data=learn.survey2 ;
 74         NumID = Input(ID, 3.) ;
             _____
             180
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 75         by NumID ;
 ERROR: Variable NUMID not found.
 76         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 77         
 
 
 78         Data review.Prob10_13 ;
 79         merge learn.demographic2(in=indemographic2)
 80               learn.survey2(in=inSurvey2) ;
 81         by NumID ;
 82         If Indemographic2 InSurvey2 ;
                               _________
                               22
 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, 
               LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  
 
 83         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set REVIEW.PROB10_13 may be incomplete.  When this step was stopped there were 0 observations and 10 variables.
 WARNING: Data set REVIEW.PROB10_13 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 84         
 85         proc print data=review.Prob10_13 noobs ;
 86         run ;
 
 NOTE: There were 9 observations read from the data set REVIEW.PROB10_13.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.11 seconds
       cpu time            0.10 seconds
       
 
 87         
 88         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 101        &lt;/PRE&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457509#M116002</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-25T20:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457513#M116003</link>
      <description>&lt;P&gt;Start here:&lt;/P&gt;
&lt;PRE&gt;proc sort data=learn.demographic2 ;
 69         NumID = Input(ID, 3.) ;
             _____
&lt;/PRE&gt;
&lt;P&gt;SORT sorts, it does not do any calculation. The main thing sort will expect are BY to express the order a sort occurs in or a Key statement to indicate which variable(s) might be used for a key sort.&lt;/P&gt;
&lt;PRE&gt;82         If Indemographic2 InSurvey2 ;
                               _________
                               22
 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, 
               LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  
&lt;/PRE&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;Then with&lt;/P&gt;
&lt;PRE&gt;82         If Indemographic2 InSurvey2 ;
                               _________
                               22
 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, 
               LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  
&lt;/PRE&gt;
&lt;P&gt;IF expects some that can be compared. A single variable is evaluated to 0 for false or non-0 for true. Two variables will require some explicit comparison such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;      If Indemographic2 and InSurvey2 ;
&lt;/PRE&gt;
&lt;P&gt;which is true and the record kept when both variables are true (1 in this case).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;notice that AND is one of the words in the "expecting one of the following" list. SAS recognized InSurvey2 as a variable and so knows something is missing.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457513#M116003</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-25T20:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457514#M116004</link>
      <description>&lt;P&gt;You cannot have an assignment statement in the middle of a PROC SORT step.&lt;/P&gt;
&lt;P&gt;Those would need to be in a DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457514#M116004</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-25T20:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457516#M116005</link>
      <description>&lt;P&gt;PROC SORT doesn't let you create new variables.&amp;nbsp; It only sorts the existing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to create NUM_ID, you need a DATA step to do that.&amp;nbsp; Then run PROC SORT next.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For&amp;nbsp; your later error regarding the IN= variables, please explain what you want that section to accomplish.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;***************** EDITED:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OK, looks like it's a little crowded here.&amp;nbsp; Time for me to go home!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457516#M116005</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-25T20:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457530#M116007</link>
      <description>&lt;P&gt;Ok, for the IN= I just forgot the AND. That is no problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The bigger issue I am having is with renaming the vars. Below does not seem to work, and the variable NumID is not recognized.&lt;/P&gt;&lt;PRE&gt;Libname Review'/folders/myfolders/Review' ;
Libname Learn'/folders/myfolders/Learn' ;  
Libname myformat'/folders/myfolders/sasuser.v94' ; 
Options fmtsearch=(myformat) ;
Options mergenoby=error ; 

Data review.rename_vars ; 
	Set learn.demographic2 ; 
	NumID = Input(ID, 3.) ; 
	Set learn.survey2 ; 
	NumID = Input(ID, 3.) ;
run ; 
	
	
proc sort data=learn.demographic2 ; 
	by NumID ;
run ;

proc sort data=learn.survey2 ; 
	by NumID ;
run ;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Error log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Errors (2)
ERROR: Variable NUMID not found.
ERROR: Variable NUMID not found.
Warnings
Notes (20)

 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         Libname Review'/folders/myfolders/Review' ;
 NOTE: Libref REVIEW was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/Review
 63         Libname Learn'/folders/myfolders/Learn' ;
 NOTE: Libref LEARN refers to the same physical library as LEARN2.
 NOTE: Libref LEARN was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/Learn
 64         Libname myformat'/folders/myfolders/sasuser.v94' ;
 NOTE: Libref MYFORMAT refers to the same physical library as SASUSER.
 NOTE: Libref MYFORMAT was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/sasuser.v94
 65         Options fmtsearch=(myformat) ;
 66         Options mergenoby=error ;
 67         
 68         Data review.rename_vars ;
 69         Set learn.demographic2 ;
 70         NumID = Input(ID, 3.) ;
 71         Set learn.survey2 ;
 72         NumID = Input(ID, 3.) ;
 73         run ;
 
 NOTE: Format $LIKERT was not found or could not be loaded.
 NOTE: Format $LIKERT was not found or could not be loaded.
 NOTE: Format $LIKERT was not found or could not be loaded.
 NOTE: Format $LIKERT was not found or could not be loaded.
 NOTE: Format $LIKERT was not found or could not be loaded.
 NOTE: There were 4 observations read from the data set LEARN.DEMOGRAPHIC2.
 NOTE: There were 4 observations read from the data set LEARN.SURVEY2.
 NOTE: The data set REVIEW.RENAME_VARS has 4 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 74         
 75         
 76         proc sort data=learn.demographic2 ;
 77         by NumID ;
 ERROR: Variable NUMID not found.
 78         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 79         
 
 
 80         proc sort data=learn.survey2 ;
 81         by NumID ;
 ERROR: Variable NUMID not found.
 82         run ;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 83         /*proc sort data=learn.demographic2 ;
 84         by ID ;
 85         run ;
 86         
 87         proc sort data=learn.survey2 ;
 88         by ID ;
 89         run ;
 90         
 91         Data review.Prob10_13 ;
 92         merge learn.demographic2(in=indemographic2)
 93               learn.survey2(in=inSurvey2) ;
 94         by ID ;
 95         If Indemographic2=1 AND InSurvey2=1 ;
 96         run ; */
 97         
 98         /*proc print data=review.Prob10_13 noobs ;
 99         run ; */
 100        
 
 
 101        proc print data=review.rename_vars noobs;
 102        run ;
 
 NOTE: There were 4 observations read from the data set REVIEW.RENAME_VARS.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.10 seconds
       cpu time            0.11 seconds
       
 
 103        
 104        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 117        &lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 21:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457530#M116007</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-25T21:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Put Input function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457568#M116016</link>
      <description>&lt;P&gt;You must Must MUST learn the meaning of basic statements.&amp;nbsp; Take this DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data review.rename_vars ; 
	Set learn.demographic2 ; 
	NumID = Input(ID, 3.) ; 
	Set learn.survey2 ; 
	NumID = Input(ID, 3.) ;
run ; &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DATA statement names the data set being created.&amp;nbsp; The SET statement names the data set being read in.&amp;nbsp; (At a more advanced level, there's definitely more to it, but let's take the basics here.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the subsequent changes made by your programming statements (such as creating NumID) have zero impact on the contents of learn.demographics2.&amp;nbsp; All the changes are part of the data set being created, review.rename_vars.&amp;nbsp; So when&amp;nbsp; your later steps use learn.demographics2, those steps are using a data set that does not contain NumID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I'm not sure what your plan was, and why you are using two SET statements.&amp;nbsp; But this DATA step definitely changed the contents of review.rename_vars.&amp;nbsp; You may need to rebuild it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Input-function/m-p/457568#M116016</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-26T10:04:56Z</dc:date>
    </item>
  </channel>
</rss>

