data have ;
input category ~ $15. amount ;
datalines ;
REGUL 15
DEPNONDTX3 32
;
run;
%macro mc_export_xls ;
PROC CONTENTS DATA = have
OUT = work.dictionnaire
NOPRINT ;
RUN ;
PROC SQL noprint ;
SELECT COMPBL(name!!
CASE
WHEN (type=1 AND
format IS MISSING)
THEN " NUMX12.9 "
WHEN (type=1) THEN " "!!
COMPRESS(cats(format,formatL,".",formatD," "))
ELSE ""
END)
,
QUOTE(LEFT(TRIM(COALESCE(label,name)))),
COUNT(*),
MAX(nobs)+1
INTO : variables SEPARATED BY " '09'x ",
: en_tete SEPARATED BY " '09'x ",
: nbVar ,
: nbObs
FROM work.dictionnaire
ORDER BY varnum
;
Quit;
FILENAME xlData "&RESULT.have.xls";
DATA _NULL_ ;
FILE xlData DROPOVER lrecl=50000 encoding= 'WE8MSWIN1252' ;
SET have ;
PUT &variables ;
run ;
%mend ;
%mc_export_xls ;
Hello,
I have a dataset with a characters string column. by exporting the dataset , a character space appaers at the end of the text.
How could I prevent this space ?
thanks in advance for your help
regards
Nasser
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.