BookmarkSubscribeRSS Feed
rohit_prajapati
Calcite | Level 5

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.

4 REPLIES 4
sandyming
Calcite | Level 5

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.

rohit_prajapati
Calcite | Level 5

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

Tom
Super User Tom
Super User

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;

rohit_prajapati
Calcite | Level 5

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 6755 views
  • 0 likes
  • 3 in conversation