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.
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.
Label was lost during PROC COPY also.... You can try
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;
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-:DATASETS&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.
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.