BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6


I have some data and proc report code that I want to record a pop-up macro for.

I have a list of 1000 possible numbers that can be entered and when a number is entered such as 00460, the code created pulls the data for that number only. An example of the code is this:

data one; set all13;

if code = '00460';

run;

proc sql;

create table temp as

(select distinct clm from one

where rv_cd in ('589','270','462','012'));

quit;

and the code really goes on and on to pull various information in regards to that code 00460.

When I get to the end of the code the final piece is an html output of the report that was derived from all the proc sql, data statements of this code.

What I want is to create a macro that will start with a pop-up window asking the user to enter the code they want to run the report on. So say the pop says please enter code and you enter 00100 and then the code between the macro runs all the way to the output and the user never has to do anything but input that code into the popup window. Therefore there is no need to go in and change anything in regards to the actual data. I am just trying to make this so they don't have to re-enter a new code in the actual code everytime if that is possible.

1 REPLY 1
Tom
Super User Tom
Super User

Lets split this task up a little.

First the macro should have an input parameter that accepts the code.

%macro mymac(code= .......); .... %mend mymac;

This is how the code it passed into the macro to control which code to generate the report for.  You might have other parameters it needs.

Second the first thing the macro needs to do it verify that the code passed is a valid code so that it can stop and complain rather than run through dozens of steps reporting nothing from the data.

Third you need another program or macro that accepts the user input and then calls the macro that does the real work.

For this you can use %WINDOW and %DISPLAY to paint a form on the screen and accept user input. Google for "SAS %window %display" and you will find lots of papers.  Such as: http://www2.sas.com/proceedings/sugi24/Coders/p092-24.pdf

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2438 views
  • 0 likes
  • 2 in conversation