BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
carbs
Calcite | Level 5

Hi,

While running the following code, I get the error above:

proc reg data=australiaa outest=Coef1;

model=SMB_Dom = vrp termspread defaultspread th ;

run;

the log text looks like this:

1142 proc reg data=australiaa outest=Coef1;

1143 model SMB_Dom = vrp termspread defaultspread th ;

ERROR: Variable th in list does not match type prescribed for this list.

NOTE: The previous statement has been deleted.

1144 run;

WARNING: No variables specified for an SSCP matrix. Execution terminating.

NOTE: PROCEDURE REG used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

NOTE: The data set WORK.COEF1 has 0 observations and 4 variables

Do I understand correctly that the error seems to come because the variable th is not numeric/continuous? I imported it from excel and formatted the cell to be in numeric values so I don't understand what's the problem.. I'd appreciate if someone had the time to help?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

How did you import it.  Does TH have a lot of missing values?

If you are using PROC IMPORT try increasing the value of the guessingrows option so that it looks at more records before deciding the variable type.

Or you could just fix it with a data step.

data new;

   set old (rename=(th = th_char)) ;

  th = input(th_char,best.);

run;

View solution in original post

7 REPLIES 7
Doc_Duke
Rhodochrosite | Level 12

Just because you formatted the column in Excel as numeric does not mean that SAS will treat it that way.  SAS actually looks at the data in the spreadsheet and makes its best guess.  Run a PROC CONTENTS on the data to see what SAS thinks it is.

You can override the guess, but we need to know the tool you are using to offer suggestions.  IMHO, SAS Enterprise Guide offers the most flexibility for importing Excel files.

Doc Muhlbaier

Duke

Tom
Super User Tom
Super User

How did you import it.  Does TH have a lot of missing values?

If you are using PROC IMPORT try increasing the value of the guessingrows option so that it looks at more records before deciding the variable type.

Or you could just fix it with a data step.

data new;

   set old (rename=(th = th_char)) ;

  th = input(th_char,best.);

run;

carbs
Calcite | Level 5

I used the import wizard.. There are no missing values in th at all. It's an excel file so I guess the guessing part isn't relevant here? I'll try the data step you mentioned, let's see if I can get it working.

Doc_Duke
Rhodochrosite | Level 12

The guessing part is relevant to Excel files.

Since you say there is no missing data, there is a good chance that some of your numeric input is, in fact, a characterr string.  For instance, a leading blank makes a number read as character but you may not be able to see it in just "looking" at the spreadsheet.

carbs
Calcite | Level 5

Changed the guessing rows from 20->200 and ran the codes again, no change... Used also the following datastep:

data three2;

   set three (rename=(threembill = threembill_char)) ;

  threembill = input(threembill_char,best.);

run;

So the data three is the old data containing the variable th (here marked as threembill). This step simply generates a file of three2, that has 3 variables, date, and 2*threembill? why did it duplicate the variable? Well, I ran the contents code and it looks like this:

             The CONTENTS Procedure

                        Alphabetic List of Variables and Attributes

          #    Variable           Type    Len    Format    Informat    Label

          1    Date               Char      7    $7.       $7.         Date

          3    threembill         Num       8

          2    threembill_char    Num       8                          threembill

So it seems the variable was a numeric one in the first place but the regression didn't work for some other reason?

Doc_Duke
Rhodochrosite | Level 12

Carbs,

Maybe you need to slow down and go back to your first dataset, australiaa.  What does the CONTENTS say about the variable "th" (not threembill)?  Data set "three" is clearly not the same "australiaa" as it has all different variables.  The additional data manipulations could have introduced additional sources of problems.

Doc

carbs
Calcite | Level 5

Solved the problem using the datastep Tom mentioned. I had also made a mistake in the code I had written earlier, which was part of the reason why the regression didn't work. Thanks for all your help, I'm still a beginner in using sas and don't know how thingsworks yet Smiley Happy

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 76578 views
  • 9 likes
  • 3 in conversation