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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1775 views
  • 0 likes
  • 2 in conversation