Solved

Inputting a macro variable from an external file

Posted on 2013-01-16
6
334 Views
Last Modified: 2013-01-17
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.
0
Comment
Question by:morinia
  • 3
  • 2
6 Comments
 
LVL 29

Expert Comment

by:gowflow
ID: 38783399
Sorry but do not understand your request
gowflow
0
 

Author Comment

by:morinia
ID: 38783515
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;
0
 
LVL 29

Expert Comment

by:gowflow
ID: 38783662
you mean an inputbox statement ???

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

is this what you want ?
gowflow
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 11

Expert Comment

by:theartfuldazzler
ID: 38785830
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

0
 
LVL 11

Expert Comment

by:theartfuldazzler
ID: 38785832
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
0
 
LVL 11

Accepted Solution

by:
theartfuldazzler earned 500 total points
ID: 38785886
PPS; And then reading your other comment #38783515

Try this:

%Window SELECT #3@5'Enter the member id numbers:' +1 ck_member 12;
%Let ck_member=;
%Display SELECT;

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
InStr Function not working properly in macro 3 19
Update from TABLE-A to TABLE-B 5 34
Easy Excel formula needed 4 23
Sum iF  based on a null cell 11 29
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now