Help using Base SAS procedures

Variable X in list does not match type prescribed for this list

Accepted Solution Solved
Reply
Contributor
Posts: 44
Accepted Solution

Variable X in list does not match type prescribed for this list

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?


Accepted Solutions
Solution
‎12-09-2011 10:43 AM
Super User
Super User
Posts: 6,708

Variable X in list does not match type prescribed for this list

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


All Replies
Trusted Advisor
Posts: 2,114

Variable X in list does not match type prescribed for this list

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

Solution
‎12-09-2011 10:43 AM
Super User
Super User
Posts: 6,708

Variable X in list does not match type prescribed for this list

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;

Contributor
Posts: 44

Re: Variable X in list does not match type prescribed for this list

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.

Trusted Advisor
Posts: 2,114

Variable X in list does not match type prescribed for this list

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.

Contributor
Posts: 44

Re: Variable X in list does not match type prescribed for this list

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?

Trusted Advisor
Posts: 2,114

Re: Variable X in list does not match type prescribed for this list

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

Contributor
Posts: 44

Re: Variable X in list does not match type prescribed for this list

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 35786 views
  • 8 likes
  • 3 in conversation