Date: Mon, 17 Oct 2011 11:39:05 -0400
Reply-To: Jack Clark <jclark@HILLTOP.UMBC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Clark <jclark@HILLTOP.UMBC.EDU>
Subject: EXCELXP Tagset Question - Telling Excel to Keep a Variable as
Text (to preserve leading zeros)
Content-Type: text/plain; charset="us-ascii"
When I use the ExcelXP tagset to send SAS Procedure output to Excel, I
have used the following code to tell SAS I want a character variable to
show as text. This prevents character variables with leading zeros from
being converted to numbers - and losing the leading zeros.
ods tagsets.excelxp file="c:\xp.xls";
id = '001';
id = '011';
id = '101';
proc print data = test;
var id / style=[tagattr='format:text'];
ods tagsets.excelxp close;
My question is...Is there are compatible way to do the same thing with
PROC FREQ output? When I send the FREQ output to Excel with the tagset,
the leading zeros are missing from the values of ID. I tried the
following, but got an Error in the log. I don't see any STYLE option
for the TABLES statement in the SAS documentation. Thank you.
proc freq data = test;
tables id / style=[tagattr='format:text'];;
8701 proc freq data = test;
8702 tables id / style=[tagattr='format:text'];;
University of Maryland, Baltimore County
Sondheim Hall, 3rd Floor
1000 Hilltop Circle
Baltimore, MD 21250
Please consider the environment before printing this e-mail and/or any attachments.
Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----
ERROR 22-322: Syntax error, expecting one of the following: ;, AGREE,
ALL, ALPHA, BDT, BIN, BINC,
BINOMIAL, BINOMIALC, CELLCHI2, CHISQ, CL, CMH, CMH1, CMH2,
CONVERGE, CROSSLIST, CUMCOL, DEVIATION, EXACT, EXPECTED,
FISHER, FORMAT, JT, KAPPA,
LIST, MAXITER, MEASURES, MISSING, MISSPRINT, NOCOL, NOCUM,
NOPRINT, NOROW, NOSPARSE, NOWARN, OUT, OUTCUM, OUTEXPECT,
OUTPCT, PDIFF, PLCORR,
PLOTS, PRINTKWT, RDIFF, RELRISK, RISKDIFF, RISKDIFFC,
SCORE, SCORES, SCOROUT,
SPARSE, TABLE, TESTF, TESTP, TOTPCT, TREND.
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.10 seconds
cpu time 0.01 seconds