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

I'm used the import wizard in SAS EG to import a sheet from an Access database. I have a query later on referencing this sheet that throws an error because one of my variables is text (ERROR: the AVG summary function requires a numeric argument), whereas it should really be a number.So, I closed out of SAS EG, went into the Access database and changed the type to number. Then, went back into SAS EG and tried running but got the same error. So then I proceeded to choose "Modify Import Data" off the import. First, a box pops up that says: The following field names are either missing from the source file or have a different base data type (string or numeric) than they originally did: My_variable (String). I clicked okay, albeit a little confused. I proceeded to modify the import, and in the define field attributes part, I changed the type of my variable to Number. The source Informat defaulted to BEST-1., which seems like an odd informat name (is it even valid?). So I clicked finish and ran it and now it is giving me the errors:

 

70                 GPI              : $CHAR14.
71                 Drug_Name        : $CHAR60.
72                 MAC_Price        : BEST-1.
                                           __
                                           22
ERROR 22-322: Expecting a name.  

73                 Eff_Date         : BEST32.
ERROR: Missing numeric suffix on a numbered variable list (BEST-NAME).

When I attempt to change this source informat, by clicking the dropdown, I received an error saying that SAS has encountered a problem, which I have inserted a screenshot of below. Is this a bug? Any way around it? Thank you for the help.

 

ImportError.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

That looks like a bug to me.  So that answers your question, but doesn't solve the problem.

 

If possible, I'd try to start over again in a new project, just to see if a clean slate will help create a process that imports the way that you need it.  I'm assuming that you're relying on the EG Import Data task and that you don't have a way to use PROC IMPORT or SAS/ACCESS to ODBC to read this data by using SAS code.  If those are options, I'd recommend them since they are probably more robust.  

 

By using the EG Import Data task, you're getting EG to read the table, convert it to an intermediate text format, and then read into a SAS data set.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

That looks like a bug to me.  So that answers your question, but doesn't solve the problem.

 

If possible, I'd try to start over again in a new project, just to see if a clean slate will help create a process that imports the way that you need it.  I'm assuming that you're relying on the EG Import Data task and that you don't have a way to use PROC IMPORT or SAS/ACCESS to ODBC to read this data by using SAS code.  If those are options, I'd recommend them since they are probably more robust.  

 

By using the EG Import Data task, you're getting EG to read the table, convert it to an intermediate text format, and then read into a SAS data set.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
jimbarbour
Meteorite | Level 14

If the file were not overly large, perhaps the Access data could be output as tab delimited text or csv.  The text could then be uploaded to your primary server and loaded into SAS using INFILE and INPUT (or PROC IMPORT or imported via SAS EG).  This is sort of a work around if what Chris suggested doesn't take care of the bug.

If you do use INFILE and INPUT, make sure to specifiy the DSD option (for delimited data) and then tell SAS exactly what delimiter you're using (tab, pipe, comma, etc.).  Below I'll list a sample with a "pipe" (vertical bar) as the delimiter.  Note the use of the colon in the INPUT statement.

FILENAME Raw_Data "&RawData./&RawFile";

DATA	SAS_Data.&SAS_File;

INFILE  Raw_Data
        LRECL=32760
		ENCODING="LATIN1"
        DLM='|'
        MISSOVER			
        DSD
		OBS=&Obs
		FIRSTOBS=1
		END=_End_of_File 
		;

	INPUT
		TT_HSN							:	8.
		TT_PIN							:	$CHAR30.
		TT_TIN							:	$CHAR12.
		;

 

Hope that helps,

 

Jim

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 1456 views
  • 1 like
  • 3 in conversation