Running two lines of MS DOS code in SAS

  • Follow


I'm trying to run stat transfer from SAS.  I've tried to use the X
command, but it opens a MS DOS application for each window.  Is there
any way to run these two lines in SAS?

cd c:\program files\stattransfer9\
st w:\trees.sas7bdat w:\trees.dta
0
Reply Dan 8/23/2010 6:43:40 PM

Dan,

As always, there are many ways of doing what I think you want to
accomplish.  The following, thus, is just one (i.e., create and run
a .bat file.  I don't have stat transfer, thus used an example of
running a dos command):

options noxwait;
data _null_;
  file "c:\art\doit.bat";
  put "c:";
  put "cd c:\art";
  put "dir  > testit.txt";
run;
x "c:\art\doit";

HTH,
Art
----------
On Aug 23, 2:43=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
> I'm trying to run stat transfer from SAS. =A0I've tried to use the X
> command, but it opens a MS DOS application for each window. =A0Is there
> any way to run these two lines in SAS?
>
> cd c:\program files\stattransfer9\
> st w:\trees.sas7bdat w:\trees.dta

0
Reply Arthur 8/23/2010 8:14:21 PM


Art, thanks for the suggestion!  I'll use that code in the future.
But I found the MS DOS code to combine two lines

options xwait XSYNC;
x 'cd c:\program files\stattransfer9\ & st "W:\trees.xls" "w:
\trees_test.sas7bdat" "-T<trees"';
run;

On Aug 23, 4:14=A0pm, Arthur Tabachneck <art...@netscape.net> wrote:
> Dan,
>
> As always, there are many ways of doing what I think you want to
> accomplish. =A0The following, thus, is just one (i.e., create and run
> a .bat file. =A0I don't have stat transfer, thus used an example of
> running a dos command):
>
> options noxwait;
> data _null_;
> =A0 file "c:\art\doit.bat";
> =A0 put "c:";
> =A0 put "cd c:\art";
> =A0 put "dir =A0> testit.txt";
> run;
> x "c:\art\doit";
>
> HTH,
> Art
> ----------
> On Aug 23, 2:43=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
>
> > I'm trying to run stat transfer from SAS. =A0I've tried to use the X
> > command, but it opens a MS DOS application for each window. =A0Is there
> > any way to run these two lines in SAS?
>
> > cd c:\program files\stattransfer9\
> > st w:\trees.sas7bdat w:\trees.dta

0
Reply dt4540 (11) 8/23/2010 8:27:57 PM

Dan,

Take a look at the other responses that were posted over on the sas-l
listerv, i.e.,
http://www.listserv.uga.edu/cgi-bin/wa?A2=3Dind1008d&L=3Dsas-l&D=3D1&O=3DD&=
P=3D6449

Since your path contains a space, you especially want to look at the
quoting than Dan Nordlund recommended.

Art
--------------
On Aug 23, 4:27=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
> Art, thanks for the suggestion! =A0I'll use that code in the future.
> But I found the MS DOS code to combine two lines
>
> options xwait XSYNC;
> x 'cd c:\program files\stattransfer9\ & st "W:\trees.xls" "w:
> \trees_test.sas7bdat" "-T<trees"';
> run;
>
> On Aug 23, 4:14=A0pm, Arthur Tabachneck <art...@netscape.net> wrote:
>
>
>
> > Dan,
>
> > As always, there are many ways of doing what I think you want to
> > accomplish. =A0The following, thus, is just one (i.e., create and run
> > a .bat file. =A0I don't have stat transfer, thus used an example of
> > running a dos command):
>
> > options noxwait;
> > data _null_;
> > =A0 file "c:\art\doit.bat";
> > =A0 put "c:";
> > =A0 put "cd c:\art";
> > =A0 put "dir =A0> testit.txt";
> > run;
> > x "c:\art\doit";
>
> > HTH,
> > Art
> > ----------
> > On Aug 23, 2:43=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
>
> > > I'm trying to run stat transfer from SAS. =A0I've tried to use the X
> > > command, but it opens a MS DOS application for each window. =A0Is the=
re
> > > any way to run these two lines in SAS?
>
> > > cd c:\program files\stattransfer9\
> > > st w:\trees.sas7bdat w:\trees.dta- Hide quoted text -
>
> - Show quoted text -

0
Reply art297 (4237) 8/23/2010 9:40:09 PM

 PROC IMPORT can read Stata data into SAS. It would be more elegant in
this scenario.  But it depends on what version of SAS you are using,
and also what version of Stata the incoming data is in. Some versions
are not compatible.

T

Arthur Tabachneck wrote:
> Dan,
>
> Take a look at the other responses that were posted over on the sas-l
> listerv, i.e.,
> http://www.listserv.uga.edu/cgi-bin/wa?A2=3Dind1008d&L=3Dsas-l&D=3D1&O=3D=
D&P=3D6449
>
> Since your path contains a space, you especially want to look at the
> quoting than Dan Nordlund recommended.
>
> Art
> --------------
> On Aug 23, 4:27=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
> > Art, thanks for the suggestion! =A0I'll use that code in the future.
> > But I found the MS DOS code to combine two lines
> >
> > options xwait XSYNC;
> > x 'cd c:\program files\stattransfer9\ & st "W:\trees.xls" "w:
> > \trees_test.sas7bdat" "-T<trees"';
> > run;
> >
> > On Aug 23, 4:14=A0pm, Arthur Tabachneck <art...@netscape.net> wrote:
> >
> >
> >
> > > Dan,
> >
> > > As always, there are many ways of doing what I think you want to
> > > accomplish. =A0The following, thus, is just one (i.e., create and run
> > > a .bat file. =A0I don't have stat transfer, thus used an example of
> > > running a dos command):
> >
> > > options noxwait;
> > > data _null_;
> > > =A0 file "c:\art\doit.bat";
> > > =A0 put "c:";
> > > =A0 put "cd c:\art";
> > > =A0 put "dir =A0> testit.txt";
> > > run;
> > > x "c:\art\doit";
> >
> > > HTH,
> > > Art
> > > ----------
> > > On Aug 23, 2:43=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
> >
> > > > I'm trying to run stat transfer from SAS. =A0I've tried to use the =
X
> > > > command, but it opens a MS DOS application for each window. =A0Is t=
here
> > > > any way to run these two lines in SAS?
> >
> > > > cd c:\program files\stattransfer9\
> > > > st w:\trees.sas7bdat w:\trees.dta- Hide quoted text -
> >
> > - Show quoted text -
0
Reply tanwanzang (263) 8/24/2010 6:55:53 PM

 PROC IMPORT can read Stata data into SAS. It would be more elegant in
this scenario.  But it depends on what version of SAS you are using,
and also what version of Stata the incoming data is in. Some versions
are not compatible.

T

Arthur Tabachneck wrote:
> Dan,
>
> Take a look at the other responses that were posted over on the sas-l
> listerv, i.e.,
> http://www.listserv.uga.edu/cgi-bin/wa?A2=3Dind1008d&L=3Dsas-l&D=3D1&O=3D=
D&P=3D6449
>
> Since your path contains a space, you especially want to look at the
> quoting than Dan Nordlund recommended.
>
> Art
> --------------
> On Aug 23, 4:27=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
> > Art, thanks for the suggestion! =A0I'll use that code in the future.
> > But I found the MS DOS code to combine two lines
> >
> > options xwait XSYNC;
> > x 'cd c:\program files\stattransfer9\ & st "W:\trees.xls" "w:
> > \trees_test.sas7bdat" "-T<trees"';
> > run;
> >
> > On Aug 23, 4:14=A0pm, Arthur Tabachneck <art...@netscape.net> wrote:
> >
> >
> >
> > > Dan,
> >
> > > As always, there are many ways of doing what I think you want to
> > > accomplish. =A0The following, thus, is just one (i.e., create and run
> > > a .bat file. =A0I don't have stat transfer, thus used an example of
> > > running a dos command):
> >
> > > options noxwait;
> > > data _null_;
> > > =A0 file "c:\art\doit.bat";
> > > =A0 put "c:";
> > > =A0 put "cd c:\art";
> > > =A0 put "dir =A0> testit.txt";
> > > run;
> > > x "c:\art\doit";
> >
> > > HTH,
> > > Art
> > > ----------
> > > On Aug 23, 2:43=A0pm, Dan Thompson <dt4...@gmail.com> wrote:
> >
> > > > I'm trying to run stat transfer from SAS. =A0I've tried to use the =
X
> > > > command, but it opens a MS DOS application for each window. =A0Is t=
here
> > > > any way to run these two lines in SAS?
> >
> > > > cd c:\program files\stattransfer9\
> > > > st w:\trees.sas7bdat w:\trees.dta- Hide quoted text -
> >
> > - Show quoted text -
0
Reply tanwanzang (263) 8/24/2010 6:56:42 PM

5 Replies
459 Views

(page loaded in 0.297 seconds)

Similiar Articles:













7/23/2012 3:36:34 PM


Reply: