BookmarkSubscribeRSS Feed
natistics
Calcite | Level 5

Hello,

 

I am using the following code to import Access tables in SAS 9.4 TS Level 1M1:

 

libname PREP 'J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\SAS';

%macro imp (num=);

	PROC IMPORT OUT= prep.EBPMPC&num DATATABLE= "EBPM Planning Calendar Updated" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
		textsize=30000;
	RUN;

	PROC IMPORT OUT= prep.CAL&num DATATABLE= "Cohort Attendance Log" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
	RUN;

	PROC IMPORT OUT= prep.CFC&num DATATABLE= "Cohort Fidelity Checklist" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
	RUN;

	PROC IMPORT OUT= prep.IS&num DATATABLE= "Implementation Sites" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
	RUN;

	PROC IMPORT OUT= prep.PAL&num DATATABLE= "Participant Attendance Log" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
	RUN;

	PROC IMPORT OUT= prep.PC&num DATATABLE= "Planned Curricula" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
	RUN;

	PROC IMPORT OUT= prep.SNSC&num DATATABLE= "Site Name and Site Code" DBMS=ACCESSCS REPLACE;
		DATABASE="J:\Program Evaluation Section\Adolescent Education Programs\PREP\Data\Access\300\&num..accdb";
		SCANMEMO=YES;
		USEDATE=YES;
		SCANTIME=YES;
		MEMOSIZE=32767;
	RUN;

%mend imp;

%imp(num=301);

 

 

Two columns of data are being truncated. These columns have something in common: "#" is a character in some of the cells. All other data is being imported properly and I am not receiving any error messages. Any advice for bringing in the data correctly?

 

Thank you!

4 REPLIES 4
Reeza
Super User
Try and ODBC connection instead of ACCESSCS? Or do need ACCESSCS? For the fields that are being truncated, are they set as character or numeric in Access, and what type is SAS setting them to be?
natistics
Calcite | Level 5

They are text in Access and character in SAS. Trying to figure out ODBC - any introductory resource you can share? Thank you!

Reeza
Super User

@natistics wrote:

They are text in Access and character in SAS. 

 

What are the lengths?


 

natistics
Calcite | Level 5

255 in Access. In SAS, one variables is 3, the other is 4. Is there a way to set length through proc import?

 

Thank you!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1740 views
  • 0 likes
  • 2 in conversation