Help using Base SAS procedures

Datasets Labels gets missing after converted .XPT to SAS

Reply
Occasional Contributor
Posts: 17

Datasets Labels gets missing after converted .XPT to SAS

When i am converting .XPT files to SAS datasets files datasets Labels gets missing. Kindly provide the resolution.

Note - Converting bunch of XPT files to SAS datasets through macro.

Contributor
Posts: 32

Re: Datasets Labels gets missing after converted .XPT to SAS

if you used PROC COPY/CIMPORT, the label should still here.

If you used SET statement in the macro, then the label would be lost.

Occasional Contributor
Posts: 17

Re: Datasets Labels gets missing after converted .XPT to SAS

Label was lost during PROC COPY also....   You can try

Super User
Super User
Posts: 6,499

Re: Datasets Labels gets missing after converted .XPT to SAS

Check your macro.  SAS is not doing it.  Try this test to see for yourself.

filename out temp;

libname out xport ;

data out.class(label='My label'); set sashelp.class; run;

proc copy inlib=out outlib=work; run;

proc contents data=class;

run;

Occasional Contributor
Posts: 17

Re: Datasets Labels gets missing after converted .XPT to SAS

Below is the macro code..........


/****** Macro to convert .XPT files to sas datasets *****************/


options mprint symbolgen mlogic;


/******************* Import domain sheet **************/


%MACRO DSAT(DOMAIN=);

proc import datafile = "...................../domains.xls" out=&DOMAIN
Replace
DBMS=xls;
getnames=yes;
run;


/********* Domains sheet contain list of the datasets i.e. ae, dm, ds, eg...... ***********/


PROC SQL;
SELECT COUNT(*) INTO :CNT FROM &DOMAIN;
QUIT;

%PUT &CNT.;

%let CNT = %EVAL(&CNT.);

PROC SQL;
SELECT DISTINCT DATASETS INTO: DATASETS1-Smiley Very HappyATASETS&CNT FROM &DOMAIN;
QUIT;

%DO I=1 %TO &CNT;

LIBNAME DT XPORT "............./&&DATASETS&I...xpt"; /**** Path contain .XPT files which we mapped with Domains excel sheet ****/

PROC COPY IN = DT OUT=WORK;
RUN;

%END;

%MEND;
%DSAT(DOMAIN=domains);

/******** Excel data contains *******/

datasets
ae
cm
dm
ds
eg
ex

/************/

while generating the output.... For Some of the datasets the LABEL was lost in output.

Can you please let me know the resolution or any other ways to retain the LABEL.

Ask a Question
Discussion stats
  • 4 replies
  • 1216 views
  • 0 likes
  • 3 in conversation