BookmarkSubscribeRSS Feed
acleamon
Calcite | Level 5
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 PROC IMPORT DATAFILE= "/home/u63997444/ECON 348/Master_use_edited_again2.csv"
70 OUT=Master_d
71 DBMS=csv
72 REPLACE;
73 GETNAMES=Yes;
74 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.
12 REPLIES 12
SASKiwi
PROC Star

That is a NOTE not an ERROR so your import will still work. Please post your complete SAS log to confirm.

acleamon
Calcite | Level 5

PROC IMPORT DATAFILE= "/home/u63997444/ECON 348/Master_use_edited_again2.csv"
OUT=Master_d
DBMS=csv
REPLACE;
GETNAMES=Yes;
RUN;

proc contents data=Master_d;
run;

proc means data=Master_d;
run;

data capsizedata;
set Master_d;

/* Assigning capsize based on Firm */
if 1 <= Firm <= 10 then capsize = "mega";
else if 11 <= Firm <= 20 then capsize = "large";
else if 21 <= Firm <= 30 then capsize = "mid";
else if 31 <= Firm <= 40 then capsize = "small";
else if 41 <= Firm <= 50 then capsize = "micro";
else capsize = "unknown"; /* Default case for capsize if Firm is not in expected range */

/* Convert capsize into numeric dummy variables for regression */
if capsize = "mega" then capsize_mega = 1; else capsize_mega = 0;
if capsize = "large" then capsize_large = 1; else capsize_large = 0;
if capsize = "mid" then capsize_mid = 1; else capsize_mid = 0;
if capsize = "small" then capsize_small = 1; else capsize_small = 0;
if capsize = "micro" then capsize_micro = 1; else capsize_micro = 0;

data capsizedata;
set Master_d;
/* Assigning capsizeadjust based on MarketCap */
if MarketCap >= 2 then capsizeadjust = "mega_ad";
else if 10000000000 <= MarketCap <= 200000000000 then capsizeadjust = "large_ad";
else if 2000000000 <= MarketCap <= 10000000000 then capsizeadjust = "mid_ad";
else if 300000000 <= MarketCap <= 2000000000 then capsizeadjust = "small_ad";
else if 50000000 <= MarketCap <= 300000000 then capsizeadjust = "micro_ad";
else capsizeadjust = "unknown"; /* Default case for capsizeadjust if MarketCap is not in expected range */
run;

proc reg data=Master_d;
Model Price= MarketCap;
run;

proc reg data=capsizedata;
model Price =capsize_mega capsize_large capsize_mid capsize_small capsize_micro;
run;

proc print data=Master_d (obs=10);
run;

proc print data=capsizedata (obs=10);
run;

acleamon
Calcite | Level 5
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 PROC IMPORT DATAFILE= "/home/u63997444/ECON 348/Master_use_edited_again2.csv"
70 OUT=Master_d
71 DBMS=csv
72 REPLACE;
73 GETNAMES=Yes;
74 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.
75 /**********************************************************************
76 * PRODUCT: SAS
77 * VERSION: 9.4
78 * CREATOR: External File Interface
79 * DATE: 11DEC24
80 * DESC: Generated SAS Datastep Code
81 * TEMPLATE SOURCE: (None Specified.)
82 ***********************************************************************/
83 data WORK.MASTER_D ;
84 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
85 infile '/home/u63997444/ECON 348/Master_use_edited_again2.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
86 informat Date mmddyy10. ;
87 informat " Price"N best32. ;
88 informat " MarketCap"N best32. ;
89 informat Shares best32. ;
90 informat Firm best32. ;
91 informat FirmName $5. ;
92 format Date mmddyy10. ;
93 format " Price"N best12. ;
94 format " MarketCap"N best12. ;
95 format Shares best12. ;
96 format Firm best12. ;
97 format FirmName $5. ;
98 input
99 Date
100 " Price"N
101 " MarketCap"N
102 Shares
103 Firm
104 FirmName $
105 ;
106 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
107 run;
 
NOTE: The infile '/home/u63997444/ECON 348/Master_use_edited_again2.csv' is:
Filename=/home/u63997444/ECON 348/Master_use_edited_again2.csv,
Owner Name=u63997444,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=10Dec2024:10:40:10,
File Size (bytes)=3210548
 
NOTE: 60885 records were read from the infile '/home/u63997444/ECON 348/Master_use_edited_again2.csv'.
The minimum record length was 44.
The maximum record length was 66.
NOTE: The data set WORK.MASTER_D has 60885 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.00 seconds
memory 11821.15k
OS Memory 32028.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 24 Switch Count 2
Page Faults 0
Page Reclaims 486
Page Swaps 0
Voluntary Context Switches 15
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 5904
 
 
60885 rows created in WORK.MASTER_D from /home/u63997444/ECON 348/Master_use_edited_again2.csv.
 
 
 
NOTE: WORK.MASTER_D data set was successfully created.
NOTE: The data set WORK.MASTER_D has 60885 observations and 6 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.08 seconds
user cpu time 0.06 seconds
system cpu time 0.02 seconds
memory 11821.15k
OS Memory 32544.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 24 Switch Count 8
Page Faults 0
Page Reclaims 4383
Page Swaps 0
Voluntary Context Switches 97
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 5992
 
 
108
109 proc contents data=Master_d;
110 run;
 
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.02 seconds
user cpu time 0.03 seconds
system cpu time 0.01 seconds
memory 3361.53k
OS Memory 27564.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 25 Switch Count 0
Page Faults 0
Page Reclaims 684
Page Swaps 0
Voluntary Context Switches 3
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 8
 
 
111
112 proc means data=Master_d;
113 run;
 
NOTE: There were 60885 observations read from the data set WORK.MASTER_D.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.02 seconds
user cpu time 0.02 seconds
system cpu time 0.00 seconds
memory 7739.09k
OS Memory 32444.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 26 Switch Count 1
Page Faults 0
Page Reclaims 1652
Page Swaps 0
Voluntary Context Switches 42
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 16
 
 
114
115 data capsizedata;
116 set Master_d;
117
118 /* Assigning capsize based on Firm */
119 if 1 <= Firm <= 10 then capsize = "mega";
120 else if 11 <= Firm <= 20 then capsize = "large";
121 else if 21 <= Firm <= 30 then capsize = "mid";
122 else if 31 <= Firm <= 40 then capsize = "small";
123 else if 41 <= Firm <= 50 then capsize = "micro";
124 else capsize = "unknown"; /* Default case for capsize if Firm is not in expected range */
125
126 /* Convert capsize into numeric dummy variables for regression */
127 if capsize = "mega" then capsize_mega = 1; else capsize_mega = 0;
128 if capsize = "large" then capsize_large = 1; else capsize_large = 0;
129 if capsize = "mid" then capsize_mid = 1; else capsize_mid = 0;
130 if capsize = "small" then capsize_small = 1; else capsize_small = 0;
131 if capsize = "micro" then capsize_micro = 1; else capsize_micro = 0;
132
 
NOTE: There were 60885 observations read from the data set WORK.MASTER_D.
NOTE: The data set WORK.CAPSIZEDATA has 60885 observations and 12 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 3575.78k
OS Memory 29356.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 27 Switch Count 2
Page Faults 0
Page Reclaims 526
Page Swaps 0
Voluntary Context Switches 12
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 11536
 
 
133 data capsizedata;
134 set Master_d;
135 /* Assigning capsizeadjust based on MarketCap */
136 if MarketCap >= 2 then capsizeadjust = "mega_ad";
137 else if 10000000000 <= MarketCap <= 200000000000 then capsizeadjust = "large_ad";
138 else if 2000000000 <= MarketCap <= 10000000000 then capsizeadjust = "mid_ad";
139 else if 300000000 <= MarketCap <= 2000000000 then capsizeadjust = "small_ad";
140 else if 50000000 <= MarketCap <= 300000000 then capsizeadjust = "micro_ad";
141 else capsizeadjust = "unknown"; /* Default case for capsizeadjust if MarketCap is not in expected range */
142 run;
 
NOTE: Variable MarketCap is uninitialized.
NOTE: There were 60885 observations read from the data set WORK.MASTER_D.
NOTE: The data set WORK.CAPSIZEDATA has 60885 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.01 seconds
memory 3563.93k
OS Memory 29356.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 28 Switch Count 2
Page Faults 0
Page Reclaims 531
Page Swaps 0
Voluntary Context Switches 12
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 7696
 
 
143
144 proc reg data=Master_d;
145 Model Price= MarketCap;
ERROR: Variable PRICE not found.
ERROR: Variable MARKETCAP not found.
NOTE: The previous statement has been deleted.
146 run;
 
WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 3498.31k
OS Memory 28864.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 29 Switch Count 0
Page Faults 0
Page Reclaims 616
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 48
 
 
147
148 proc reg data=capsizedata;
149 model Price =capsize_mega capsize_large capsize_mid capsize_small capsize_micro;
ERROR: Variable PRICE not found.
ERROR: Variable CAPSIZE_MEGA not found.
ERROR: Variable CAPSIZE_LARGE not found.
ERROR: Variable CAPSIZE_MID not found.
ERROR: Variable CAPSIZE_SMALL not found.
ERROR: Variable CAPSIZE_MICRO not found.
NOTE: The previous statement has been deleted.
150 run;
 
WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 3497.43k
OS Memory 28864.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 30 Switch Count 0
Page Faults 0
Page Reclaims 445
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 56
 
 
151
152 proc print data=Master_d (obs=10);
153 run;
 
NOTE: There were 10 observations read from the data set WORK.MASTER_D.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
user cpu time 0.02 seconds
system cpu time 0.00 seconds
memory 2003.18k
OS Memory 27304.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 31 Switch Count 0
Page Faults 0
Page Reclaims 270
Page Swaps 0
Voluntary Context Switches 1
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
 
154
155 proc print data=capsizedata (obs=10);
156 run;
 
NOTE: There were 10 observations read from the data set WORK.CAPSIZEDATA.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 2018.37k
OS Memory 27304.00k
Timestamp 12/11/2024 08:32:43 PM
Step Count 32 Switch Count 0
Page Faults 0
Page Reclaims 257
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
 
157
158 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
168
 
My teacher said the reason is this as its something she has never seen before
Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
SASKiwi
PROC Star

Your errors start at this step: 

 

143
144 proc reg data=Master_d;
145 Model Price= MarketCap;
ERROR: Variable PRICE not found.
ERROR: Variable MARKETCAP not found.
NOTE: The previous statement has been deleted.
146 run;

My suspicion is that the variables are _Price and _MarketCap because there were leading spaces on the imported column headings you are using as variable names. What does the PROC CONTENTS of the dataset report?

 

acleamon
Calcite | Level 5
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 proc contents data=Master_d;
70 run;
 
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.02 seconds
user cpu time 0.03 seconds
system cpu time 0.01 seconds
memory 3192.09k
OS Memory 26284.00k
Timestamp 12/11/2024 09:11:15 PM
Step Count 42 Switch Count 0
Page Faults 0
Page Reclaims 571
Page Swaps 0
Voluntary Context Switches 3
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 16
 
 
71
72 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
82
 
Shows this for the log and results look normal - imported results as pdf 
SASKiwi
PROC Star

I agree, PROC CONTENTS looks OK. Does a rerun give you the same error?

 

 

ballardw
Super User

One of the things you will learn to consider is leading blanks in unexpected places and that the way 99% of the output created, HTML, PDF, RTF especially may not display them.  Please run this code as an example:

data junk;
   var = "         abc";output;
   var = "    abc";output;
   var = "abc"; output;
run;

proc freq data=junk;
   tables var;
run;

What does  your output look like?

 

Mine:

The FREQ Procedure

 

var Frequency Percent Cumulative
Frequency
Cumulative
Percent
abc 1 33.33 1 33.33
abc 1 33.33 2 66.67
abc 1 33.33 3 100.00

NONE of the leading spaces of the values show but the different values are counted as separate by the Freq Procedure (and others).

The same happens with Proc Contents and the name literals.

data stupidnames;
   '    name1'n='Boy';
run;

proc contents data=stupidnames;
run;

with output in part again not showing the leading spaces.


Alphabetic List of Variables and Attributes
# Variable Type Len
1 name1 Char 3

 

The name literals were added to SAS to allow references to variables in other data sources such as external databases a bit easier for those that allow other characters in names other than letters, digits or the _ character that SAS uses natively.

 

 

Tom
Super User Tom
Super User

That highlights on of the biggest problems with ODS output.  It "eats" leading spaces.

 

If you run the same code and send the results to the normal OUTPUT (what they now call the LISTING destination) then you will see the leading spaces.

ballardw
Super User

Your real problem is that you are referencing values or variables not in your data set:

33 data capsizedata;
134 set Master_d;
135 /* Assigning capsizeadjust based on MarketCap */
136 if MarketCap >= 2 then capsizeadjust = "mega_ad";
137 else if 10000000000 <= MarketCap <= 200000000000 then capsizeadjust = "large_ad";
138 else if 2000000000 <= MarketCap <= 10000000000 then capsizeadjust = "mid_ad";
139 else if 300000000 <= MarketCap <= 2000000000 then capsizeadjust = "small_ad";
140 else if 50000000 <= MarketCap <= 300000000 then capsizeadjust = "micro_ad";
141 else capsizeadjust = "unknown"; /* Default case for capsizeadjust if MarketCap is not in expected range */
142 run;
 
NOTE: Variable MarketCap is uninitialized.

Uninitialized means the variable has no values assigned.

 

44 proc reg data=Master_d;
145 Model Price= MarketCap;
ERROR: Variable PRICE not found.
ERROR: Variable MARKETCAP not found.
NOTE: The previous statement has been deleted.
146 run;

Reading your log closer there is this bit from proc import:

83 data WORK.MASTER_D ;
84 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
85 infile '/home/u63997444/ECON 348/Master_use_edited_again2.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
86 informat Date mmddyy10. ;
87 informat " Price"N best32. ;
88 informat " MarketCap"N best32. ;

Proc import has read in the leading space in the source file as part of the name of the variable.

Which means to use that data set you must use " price"n or " marketcap"n to use those variables.

This is the result of the Option VALIDVARNAME=ANY, I suspect a default for your install and the way the file is read.

If you want to use the variables as Price and Marketcap you can edit the generated code from proc import to avoid that easily and reread the file:

data WORK.MASTER_D ;
   infile '/home/u63997444/ECON 348/Master_use_edited_again2.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
   informat Date mmddyy10. ;
   informat Price best32. ;
   informat MarketCap best32. ;
   informat Shares best32. ;
   informat Firm best32. ;
   informat FirmName $5. ;
   format Date mmddyy10. ;
   input
      Date
      Price
      MarketCap
      Shares
      Firm
      FirmName $
   ;
run;

Or RENAME the variables.

 

You also will not have the values you expect for some of the variables (when you get the code fixed above) because the character variables you create like this will have the length define by the first use if a LENGTH statement doesn't assign a length first. So Capsize will have a length of 4 characters (the number of letters in "mega") and the other values will actually be "larg" "mid" "smal" "micr" "unkn"

119 if 1 <= Firm <= 10 then capsize = "mega";

Later you will find other procedures such as Proc GLM that support CLASS variables so you don't have to create dummy variables as that can be done with your existing variables and custom formats.

 

The NOTE about the SASUSER.PARMS has nothing to do with the other problems in your code. That sort of note typically happens when there is some process attempting to use the catalog. Having two SAS sessions for the same user on a shared network might do it. I do know I can cause such with a stand-alone SAS foundation install by having two or more interactive sessions active at the same time on the computer.

 

acleamon
Calcite | Level 5

Got it thanks so much. Will try again! Appreciate it!

Kurt_Bremser
Super User

BIG (oil-tanker-sized) hint for the future: never use PROC IMPORT for text files; write the DATA step yourself, according to the documentation/description of the file. Even if no such documentation exists, you are much better at making guesses about the data structure than the IMPORT procedure.

Tom
Super User Tom
Super User

Don't use PROC IMPORT to read a CSV for anything important.  You can use it help you understand what is in the file, but once you know just write a data step to read it.

 

So replace the PROC IMPORT call with this data step instead. 

data MASTER_D ;
  infile '/home/u63997444/ECON 348/Master_use_edited_again2.csv' dsd truncover firstobs=2 ;
  input Date :mmddyy. Price MarketCap Shares Firm FirmName :$8. ;
  format date yymmdd10.;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 12 replies
  • 1892 views
  • 0 likes
  • 5 in conversation