Excel VB to call SAS read in data and run and spit out the output

  • Follow


Does anyone by any chance know how to get an excel macro to create a csv
file that could then be read in by SAS to run a model? I create a user form
in excel that the user can type in values for 15 different paramenters that
I would like to apply to my SAS data sets.   So the second question is how
to set up the read in of the csv data to correspond to needed variables in
the program?

Thanks,

Sophie
0
Reply sophiecs (12) 6/29/2007 9:44:03 PM

If you have SAS Access for OleDb or ODBC why not just read in the Excel
sheet directly? Is Excel needed as the front-end or was that just where you
created it?

Alan

Alan Churchill
Savian "Bridging SAS and Microsoft Technologies"
www.savian.net



-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sophie
Shen
Sent: Friday, June 29, 2007 3:44 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Excel VB to call SAS read in data and run and spit out the output
back to SAS

Does anyone by any chance know how to get an excel macro to create a csv
file that could then be read in by SAS to run a model? I create a user form
in excel that the user can type in values for 15 different paramenters that
I would like to apply to my SAS data sets.   So the second question is how
to set up the read in of the csv data to correspond to needed variables in
the program?

Thanks,

Sophie
0
Reply savian001 (794) 6/29/2007 11:42:27 PM


Hi Alan,

Yeah, Excel is needed as the user-interface. The user can fill in the
value for 15 parameters in the userform and their input will be stored
in one of the sheets of the workbook and they can name their scenairos
with different scenario names. all the data for one scenario will be
stored in one column. For example, scenairo1 is in column G and
scenairo2 in column H.
Ideally, next step will be another userform pops out and let the user
to choose which scenairo they wanna run in SAS.

I dunno how to make this happen. Please be free to give me any
suggestions you might have.


THanks

On 6/29/07, Alan Churchill <savian001@gmail.com> wrote:
> If you have SAS Access for OleDb or ODBC why not just read in the Excel
> sheet directly? Is Excel needed as the front-end or was that just where you
> created it?
>
> Alan
>
> Alan Churchill
> Savian "Bridging SAS and Microsoft Technologies"
> www.savian.net
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sophie
> Shen
> Sent: Friday, June 29, 2007 3:44 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Excel VB to call SAS read in data and run and spit out the output
> back to SAS
>
> Does anyone by any chance know how to get an excel macro to create a csv
> file that could then be read in by SAS to run a model? I create a user form
> in excel that the user can type in values for 15 different paramenters that
> I would like to apply to my SAS data sets.   So the second question is how
> to set up the read in of the csv data to correspond to needed variables in
> the program?
>
> Thanks,
>
> Sophie
>
>
0
Reply sophiecs (12) 6/30/2007 12:07:59 AM

Built the user form outside of Excel and then write the values into the
Excel workbook. Open Excel when done.

http://www.sascommunity.org/wiki/Step-by-step_Guide_To_Creating_Your_First_.
NET_Application_Reading_SAS

If you decide to go the VBA route (Excel), the above paper will help you get
started in how to read in SAS datasets. It is also pretty easy to submit
code to SAS with parms if the user has SAS on their PC. Otherwise, you need
integration technologies or SAS/IntrNet to submit code. This is a license
issue. Coding it in C# (.NET) vs VBA will make your life a WHOLE lot easier.

Let us know if the users have SAS on their machine and whether you have
Integration Technologies or IntrNet.

I have written quite a bit on Excel, VBA, and .NET. Search the archives and
you should find opinions on the subject. You can also look at my blog for
some old articles:

http://savian.blogspot.com/


Alan

Alan Churchill
Savian "Bridging SAS and Microsoft Technologies"
www.savian.net



-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sophie
Shen
Sent: Friday, June 29, 2007 6:08 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Excel VB to call SAS read in data and run and spit out the
output back to SAS

Hi Alan,

Yeah, Excel is needed as the user-interface. The user can fill in the
value for 15 parameters in the userform and their input will be stored
in one of the sheets of the workbook and they can name their scenairos
with different scenario names. all the data for one scenario will be
stored in one column. For example, scenairo1 is in column G and
scenairo2 in column H.
Ideally, next step will be another userform pops out and let the user
to choose which scenairo they wanna run in SAS.

I dunno how to make this happen. Please be free to give me any
suggestions you might have.


THanks

On 6/29/07, Alan Churchill <savian001@gmail.com> wrote:
> If you have SAS Access for OleDb or ODBC why not just read in the Excel
> sheet directly? Is Excel needed as the front-end or was that just where
you
> created it?
>
> Alan
>
> Alan Churchill
> Savian "Bridging SAS and Microsoft Technologies"
> www.savian.net
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sophie
> Shen
> Sent: Friday, June 29, 2007 3:44 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Excel VB to call SAS read in data and run and spit out the output
> back to SAS
>
> Does anyone by any chance know how to get an excel macro to create a csv
> file that could then be read in by SAS to run a model? I create a user
form
> in excel that the user can type in values for 15 different paramenters
that
> I would like to apply to my SAS data sets.   So the second question is how
> to set up the read in of the csv data to correspond to needed variables in
> the program?
>
> Thanks,
>
> Sophie
>
>
0
Reply savian001 (794) 6/30/2007 12:56:12 AM

3 Replies
26 Views

(page loaded in 0.09 seconds)


Reply: