Link to home
Start Free TrialLog in
Avatar of morinia
moriniaFlag for United States of America

asked on

Inputting a macro variable from an external file

I am currently executing a SAS program within an Excel Spreadsheet.  I have a macro variable within the program for member_id.

Is there a way to put the member id numbers in a  cell in Excel and read into the Sas program as a macro variable.
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Sorry but do not understand your request
gowflow
Avatar of morinia

ASKER

I am sorry, I tried editting the question and for some reason was knocked out.  I would like to know how to use  a Macro Window to  allow a member_id number to be entered in for use in a SAS program.

I tried using the statements below, but it is not a clean entry.  I would like the cursor to be positioned exactly where the member_id needs to be entered.  Now I have to backspace and delete the all the '9's and enter the ID

%Window SELECT #3@5'Enter the member id numbers:' +1 ck_member 12;
%Let ck_member='999999999';
%Display SELECT;
you mean an inputbox statement ???

dim idnumbers as string
idnumbers = inputbox("Please Input ID number","ID number Input","")

is this what you want ?
gowflow
Hi

If the Excel sheet is currently open, you can use DDE Triplets.  This code reads in "Name" from Row1 Column1 in Book1 / Sheet1

filename ex dde 'Excel|[Book1]Sheet1!R1C1';

DATA _NULL_;
infile ex truncover;
input Name $256.;

CALL SYMPUT('Test',Name);
RUN;

%put &test;

Open in new window

PS: The easiest way to figure out the DDE triplet you want is:

1.  In Excel, Copy the cell you want to the clipboard (ie - Select the cell and press Ctrl-C)
2.  In Base SAS (not Guide unfortunately), select Solutions > Accessories > DDE Triplet

A box will open up with the DDE Triplet you need, and you can copy and paste into your program
ASKER CERTIFIED SOLUTION
Avatar of theartfuldazzler
theartfuldazzler
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial