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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 5503 views
  • 0 likes
  • 3 in conversation