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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 1488 views
  • 0 likes
  • 2 in conversation