DDE Save As Problem

  • Follow


Hi,

I have written the below code to copy created data in to a template
that has graph, and save it as different excel sheet. when i just save
it, it is getting saved and code is working fine...but when I save as
with different name, it is throwing error that is not easy to
understand for me. please help me in this.

options noxwait noxsync;
X ' "C:\Program Files\Microsoft Office\Office12\excel.exe " ';

data _null_;
x = sleep(10);
run;

FILENAME commands DDE "EXCEL|SYSTEM";

data _null_;
file commands;
PUT "[OPEN(""C:\Temp\Reports\AHTTemplate.xlsx"")]";
x=sleep(3);
run;

FILENAME ddedata DDE
"excel|[AHTTemplate.xlsx]AHT!r2c2:r13c3"
RECFM=V LRECL=25000
notab;

FILENAME DDECMDS DDE "EXCEL|SYSTEM";

data _null_;
set wrk.aht_care;
file ddedata;
put avg_AHT '09'x avg_sal '09'x;
run;

FILENAME DDECMDS DDE "EXCEL|SYSTEM";

DATA _null_;
FILE DDECMDS;
x=sleep(3);
put '[error(false)]';
PUT '[SAVE.as("C:\Temp\ahtcare.xlsx")]';
PUT " [quit()] ";
run;

filename ddecmds clear;
filename ddedata clear;

error : ERROR 22-322: Syntax error, expecting one of the following: a
name, an integer constant,
              arrayname, #, $, &, (, +, /, //, :, ;, ?, @, @@,
OVERPRINT, _ALL_, _BLANKPAGE_,
              _ODS_, _PAGE_, ~.
0
Reply Buddi 10/17/2010 11:37:44 AM

Buddi,

Your code works correctly on my system, although I was only able to
test it using the xls extension for office 2003.  I'm not familiar
with the newer versions of Excel as yet.

The only potential problem I noticed in your code was that you refer
to a wrk directory.  Does such a directory exist or had you meant to
type work?

Art
--------------
On Oct 17, 7:37=A0am, Buddi <venumadhav.gadir...@gmail.com> wrote:
> Hi,
>
> I have written the below code to copy created data in to a template
> that has graph, and save it as different excel sheet. when i just save
> it, it is getting saved and code is working fine...but when I save as
> with different name, it is throwing error that is not easy to
> understand for me. please help me in this.
>
> options noxwait noxsync;
> X ' "C:\Program Files\Microsoft Office\Office12\excel.exe " ';
>
> data _null_;
> x =3D sleep(10);
> run;
>
> FILENAME commands DDE "EXCEL|SYSTEM";
>
> data _null_;
> file commands;
> PUT "[OPEN(""C:\Temp\Reports\AHTTemplate.xlsx"")]";
> x=3Dsleep(3);
> run;
>
> FILENAME ddedata DDE
> "excel|[AHTTemplate.xlsx]AHT!r2c2:r13c3"
> RECFM=3DV LRECL=3D25000
> notab;
>
> FILENAME DDECMDS DDE "EXCEL|SYSTEM";
>
> data _null_;
> set wrk.aht_care;
> file ddedata;
> put avg_AHT '09'x avg_sal '09'x;
> run;
>
> FILENAME DDECMDS DDE "EXCEL|SYSTEM";
>
> DATA _null_;
> FILE DDECMDS;
> x=3Dsleep(3);
> put '[error(false)]';
> PUT '[SAVE.as("C:\Temp\ahtcare.xlsx")]';
> PUT " [quit()] ";
> run;
>
> filename ddecmds clear;
> filename ddedata clear;
>
> error : ERROR 22-322: Syntax error, expecting one of the following: a
> name, an integer constant,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 arrayname, #, $, &, (, +, /, //, :, ;, ?, @, =
@@,
> OVERPRINT, _ALL_, _BLANKPAGE_,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 _ODS_, _PAGE_, ~.

0
Reply art297 (4237) 10/17/2010 2:28:34 PM


Buddi,

As I mentioned, I can't test Office 2007 code, but have you tried
SaveAs rather than save.as?

Art
------------
On Oct 17, 10:28=A0am, Arthur Tabachneck <art...@netscape.net> wrote:
> Buddi,
>
> Your code works correctly on my system, although I was only able to
> test it using the xls extension for office 2003. =A0I'm not familiar
> with the newer versions of Excel as yet.
>
> The only potential problem I noticed in your code was that you refer
> to a wrk directory. =A0Does such a directory exist or had you meant to
> type work?
>
> Art
> --------------
> On Oct 17, 7:37=A0am, Buddi <venumadhav.gadir...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I have written the below code to copy created data in to a template
> > that has graph, and save it as different excel sheet. when i just save
> > it, it is getting saved and code is working fine...but when I save as
> > with different name, it is throwing error that is not easy to
> > understand for me. please help me in this.
>
> > options noxwait noxsync;
> > X ' "C:\Program Files\Microsoft Office\Office12\excel.exe " ';
>
> > data _null_;
> > x =3D sleep(10);
> > run;
>
> > FILENAME commands DDE "EXCEL|SYSTEM";
>
> > data _null_;
> > file commands;
> > PUT "[OPEN(""C:\Temp\Reports\AHTTemplate.xlsx"")]";
> > x=3Dsleep(3);
> > run;
>
> > FILENAME ddedata DDE
> > "excel|[AHTTemplate.xlsx]AHT!r2c2:r13c3"
> > RECFM=3DV LRECL=3D25000
> > notab;
>
> > FILENAME DDECMDS DDE "EXCEL|SYSTEM";
>
> > data _null_;
> > set wrk.aht_care;
> > file ddedata;
> > put avg_AHT '09'x avg_sal '09'x;
> > run;
>
> > FILENAME DDECMDS DDE "EXCEL|SYSTEM";
>
> > DATA _null_;
> > FILE DDECMDS;
> > x=3Dsleep(3);
> > put '[error(false)]';
> > PUT '[SAVE.as("C:\Temp\ahtcare.xlsx")]';
> > PUT " [quit()] ";
> > run;
>
> > filename ddecmds clear;
> > filename ddedata clear;
>
> > error : ERROR 22-322: Syntax error, expecting one of the following: a
> > name, an integer constant,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 arrayname, #, $, &, (, +, /, //, :, ;, ?, @=
, @@,
> > OVERPRINT, _ALL_, _BLANKPAGE_,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 _ODS_, _PAGE_, ~.- Hide quoted text -
>
> - Show quoted text -

0
Reply art297 (4237) 10/17/2010 3:52:40 PM

On 10=BF=F917=C0=CF, =BF=C0=C8=C48=BD=C337=BA=D0, Buddi <venumadhav.gadir..=
..@gmail.com> wrote:
> Hi,
>
> I have written the below code to copy created data in to a template
> that has graph, and save it as different excel sheet. when i just save
> it, it is getting saved and code is working fine...but when I save as
> with different name, it is throwing error that is not easy to
> understand for me. please help me in this.
>
> options noxwait noxsync;
> X ' "C:\Program Files\Microsoft Office\Office12\excel.exe " ';
>
> data _null_;
> x =3D sleep(10);
> run;
>
> FILENAME commands DDE "EXCEL|SYSTEM";
>
> data _null_;
> file commands;
> PUT "[OPEN(""C:\Temp\Reports\AHTTemplate.xlsx"")]";
> x=3Dsleep(3);
> run;
>
> FILENAME ddedata DDE
> "excel|[AHTTemplate.xlsx]AHT!r2c2:r13c3"
> RECFM=3DV LRECL=3D25000
> notab;
>
> FILENAME DDECMDS DDE "EXCEL|SYSTEM";
>
> data _null_;
> set wrk.aht_care;
> file ddedata;
> put avg_AHT '09'x avg_sal '09'x;
> run;
>
> FILENAME DDECMDS DDE "EXCEL|SYSTEM";
>
> DATA _null_;
> FILE DDECMDS;
> x=3Dsleep(3);
> put '[error(false)]';
> PUT '[SAVE.as("C:\Temp\ahtcare.xlsx")]';
> PUT " [quit()] ";
> run;
>
> filename ddecmds clear;
> filename ddedata clear;
>
> error : ERROR 22-322: Syntax error, expecting one of the following: a
> name, an integer constant,
>               arrayname, #, $, &, (, +, /, //, :, ;, ?, @, @@,
> OVERPRINT, _ALL_, _BLANKPAGE_,
>               _ODS_, _PAGE_, ~.

hi Buddi...
i'm not sure about that but you may have problem with the other name
when you save the Excel file...
in the save.as statement Sas doesn't recongnize the space(or blank)...

so here is EX)
if you use as below:
        PUT '[SAVE.as("C:\work\my job\ahtcare.xlsx")]';
sas only read until here : PUT '[SAVE.as("C:\work\my

i've just had that problem 10min ago exactly same thing with you...
hope it helps you out a lot..

Yu, hyojong (Rex) from Unison in korea..
0
Reply opasdf0505 (9) 10/19/2010 4:52:41 AM

The Save As code was tremendous.  Thanks so much.
0
Reply MEWashburn (1) 10/26/2012 8:07:36 PM

4 Replies
548 Views

(page loaded in 0.102 seconds)

Similiar Articles:













7/21/2012 8:28:13 PM


Reply: