Hello,
Hope you are doing well, I'm having the following issue in SAS University Studio:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 Proc Import Datafile= "/folders/myfolders/m3_mdv_data.csv" out=MDV REPLACE;
NOTE: The previous statement has been deleted.
74 Input Code;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
75 Run;
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
76 /**********************************************************************
77 * PRODUCT: SAS
78 * VERSION: 9.4
79 * CREATOR: External File Interface
80 * DATE: 19SEP19
81 * DESC: Generated SAS Datastep Code
82 * TEMPLATE SOURCE: (None Specified.)
83 ***********************************************************************/
84 data WORK.MDV ;
85 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
86 infile '/folders/myfolders/m3_mdv_data.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
87 informat CODE $10. ;
88 informat ORIGCITY $8. ;
89 informat COUNTRY $9. ;
90 informat TYPE $4. ;
91 informat CITY $9. ;
92 informat COMPANY $25. ;
93 informat MONTH best32. ;
94 informat DAY best32. ;
95 informat YEAR best32. ;
96 informat SALES93 best32. ;
97 informat SALES95 best32. ;
98 informat SALES94 best32. ;
99 informat _4CAST96 best32. ;
100 format CODE $10. ;
101 format ORIGCITY $8. ;
102 format COUNTRY $9. ;
103 format TYPE $4. ;
104 format CITY $9. ;
105 format COMPANY $25. ;
106 format MONTH best12. ;
107 format DAY best12. ;
108 format YEAR best12. ;
109 format SALES93 best12. ;
110 format SALES95 best12. ;
111 format SALES94 best12. ;
112 format _4CAST96 best12. ;
113 input
114 CODE $
115 ORIGCITY $
116 COUNTRY $
117 TYPE $
118 CITY $
119 COMPANY $
120 MONTH
121 DAY
122 YEAR
123 SALES93
124 SALES95
125 SALES94
126 _4CAST96
127 ;
128 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
129 run;
NOTE: The infile '/folders/myfolders/m3_mdv_data.csv' is:
Filename=/folders/myfolders/m3_mdv_data.csv,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=18Sep2019:22:11:33,
File Size (bytes)=11739
NOTE: 128 records were read from the infile '/folders/myfolders/m3_mdv_data.csv'.
The minimum record length was 70.
The maximum record length was 110.
NOTE: The data set WORK.MDV has 128 observations and 13 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
128 rows created in WORK.MDV from /folders/myfolders/m3_mdv_data.csv.
NOTE: WORK.MDV data set was successfully created.
NOTE: The data set WORK.MDV has 128 observations and 13 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.07 seconds
cpu time 0.05 seconds
130
131 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
143
@petergomillion wrote:
Thanks I'll do that when I get home. I was just using a random statement
showing I cant manipulate the data.
Random statements are not going to get you very far.
Try writing a simple program and see how it works.
data test;
set mdv ;
datevar=mdy(month,day,year);
format datevar yymmdd10.;
run;
proc print data=test;
var month day year datevar;
run;
Looks like your code ran to me. There was a spurious line of code at Line 74 in the log. It seems that SAS just ignored that line and so it ran the PROC IMPORT step.
What makes you think it didn't work? How did you try to use the MDV dataset that you created?
For example did you try checking out the distribution of the numeric variables?
proc means data=mdv;
run;
@petergomillion wrote:
I will try that out. I tried to just manipulate the variables and I can't
Code = "Sam";
Will not run
No it won't run. SAS have very explicit rules for dealing with modifying data sets. The block starts with either a DATA <outputsetname> or Proc <some procedure name>.
If you want to modify how your data is actually read copy that data step you show from the DATA statement to the RUN statement and paste it into the editor. Remove the line number indicators.
Make the changes there. SAVE the code in case you make a mistake and need to rerun it.
What is the Code="Sam"; supposed to do? If you place that in the body of the data step code after the input statement you would set all values of CODE to "Sam". Do you want to change the name of the variable? Create a label to describe the variable?
@petergomillion wrote:
Thanks I'll do that when I get home. I was just using a random statement
showing I cant manipulate the data.
Random statements are not going to get you very far.
Try writing a simple program and see how it works.
data test;
set mdv ;
datevar=mdy(month,day,year);
format datevar yymmdd10.;
run;
proc print data=test;
var month day year datevar;
run;
INPUT or any assignment is not valid syntax for proc import. Read the documentation for the IMPORT procedure (Maxim 1) to see the valid (and needed) statements for this procedure.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.