DATA Step, Macro, Functions and more

Variable GLDcm in list does not match type prescribed for this list.

Reply
Contributor
Posts: 27

Variable GLDcm in list does not match type prescribed for this list.

[ Edited ]

I'm using SAS University and i copied and pasted a program into a new program window, gave it a name etc. It's ready to run. I run just the import statement, it imports it fine. I run the data statement, it runs just fine. However, when i try to run the Proc Univariate statement, i get: "Variable GLDcm in list does not match type prescribed for this list." It's just a column of numbers in an excel file.

The same type of file, with the same type of columns of numbers, ran just fine in the other program, but now it won't run. However, if i convert GLDcm to logGLD using the logGLD=log(GLDcm); statement, then the Proc Univariate runs fine. I want to see if the untransformed data is normally distributed, so i don't want to do logGLD if it's not necessary.

1) Why won't SAS University recognize the column of data GLD_cm?

if that can't be resolved, 

2) how can i un-transform the logGLD back into regular numbers so that SAS will read the data?

 

Here's the code as i have it now:

%web_drop_table(WORK.IMPORT);

FILENAME FILEREF '/folders/myfolders/TreeGrowth.xlsx';

PROC IMPORT DATAFILE=FILEREF
DBMS=XLSX
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;

data TreeGrowth;
set import;
if Hgt="Ht";

logGLD=log(GLDcm);
logDBH=log(DBHcm);
logHeight=log(Height);
run;

/*proc print data=TreeGrowth;
run;*/

proc univariate Normal Plot data=TreeGrowth;
var GLDcm logGLD;
Histogram GLDcm logGLD/Normal;
QQPLOT GLDcm logGLD;
output out=AllEvents;
run;

.........................................


Thanks for the help

Respected Advisor
Posts: 2,649

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

[ Edited ]

If you are importing from Excel, sometimes a column of numbers (as seen by the human observer) is actually considered character, and thus not appropriate in PROC UNIVARIATE (one of the many drawbacks of using Excel files).

 

So you need to examine the output from PROC CONTENTS to see if this variable is character or numeric. Also, there are options in PROC IMPORT (if that's what you are using) that can force columns to be numeric.

--
Paige Miller
Super User
Posts: 22,845

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


AaronJ wrote:

I'm using SAS University and i copied and pasted a program into a new program window, gave it a name etc. It's ready to run. I run just the import statement, it imports it fine. I run the data statement, it runs just fine. However, when i try to run the Proc Univariate statement, i get: "Variable GLDcm in list does not match type prescribed for this list." It's just a column of numbers in an excel file.

The same type of file, with the same type of columns of numbers, ran just fine in the other program, but now it won't run. However, if i convert GLDcm to logGLD using the logGLD=log(GLDcm); statement, then the Proc Univariate runs fine. I want to see if the untransformed data is normally distributed, so i don't want to do logGLD if it's not necessary.

1) Why won't SAS University recognize the column of data GLD_cm?

if that can't be resolved, 

2) how can i un-transform the logGLD back into regular numbers so that SAS will read the data?

 

Here's the code as i have it now:

%web_drop_table(WORK.IMPORT);

FILENAME FILEREF '/folders/myfolders/TreeGrowth.xlsx';

PROC IMPORT DATAFILE=FILEREF
DBMS=XLSX
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;

data TreeGrowth;
set import;
if Hgt="Ht";

logGLD=log(GLDcm);
logDBH=log(DBHcm);
logHeight=log(Height);
run;

/*proc print data=TreeGrowth;
run;*/

proc univariate Normal Plot data=TreeGrowth;
var GLDcm logGLD;
Histogram GLDcm logGLD/Normal;
QQPLOT GLDcm logGLD;
output out=AllEvents;
run;

.........................................


Thanks for the help


  1. Excel doesn't force types on fields so SAS has to guess and with any guesses, it can be wrong. For example, if your file has a few missing first it will assume its character. If it has NA or . it may also assume it is missing. Some options to fix this:
    1. Make sure the cell is formatted as numeric in Excel and that there are no characters in any of the values. 
    2. Convert the file to a CSV and import it that way. Use GUESSINGROWS=MAX or check the code and customize it to import the file with the types you need.
  2. You can use INPUT() to convert the value to a numeric, but make sure to save it to a new name.
  3. new_num = input(old_name, 8.);

 

Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 1 like
  • 3 in conversation