BookmarkSubscribeRSS Feed
AshleyM
Fluorite | Level 6

Is there a way to create a web application through EG and Management Console that would capture data by a stored process. For instance, registration pages tend to have blank databases until information is entered in a customized data entry form; the data then builds as more people register. Is this something that can be done through EG and Management Console?   

9 REPLIES 9
djbateman
Lapis Lazuli | Level 10

I think the %window macro option would help out.  Attached is a simple program that adds two numbers together.  You can modify it as needed.

djbateman
Lapis Lazuli | Level 10

If this is what you are looking for, here is a helpful link to get you started using the SAS macro %window:

http://www.nesug.org/proceedings/nesug05/pm/pm13.pdf

AshleyM
Fluorite | Level 6

Djbateman,

I tried to run the code you wrote to get an idea of this is something I'd want to run, and here are the following errors I'd received.

1          ;*';*";*/;quit;run;

2          OPTIONS PAGENO=MIN;

3          %LET _CLIENTTASKLABEL='DataForm';

4          %LET _CLIENTPROJECTPATH='';

5          %LET _CLIENTPROJECTNAME='';

6          %LET _SASPROGRAMFILE='Z:\ResearchShare\Research Division SPSS Data

6        ! Files\Mason\DataForm.sas';

7         

8          ODS _ALL_ CLOSE;

9          OPTIONS DEV=ACTIVEX;

NOTE: Procedures may not support all options or statements for all devices. For details, see the

      documentation for each procedure.

10         GOPTIONS XPIXELS=0 YPIXELS=0;

11         FILENAME EGSR TEMP;

12         ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=Analysis

12       ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/EnterpriseGuide/4.3/Styles/Analysis.css

12       ! ") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");

NOTE: Writing TAGSETS.SASREPORT12(EGSR) Body file: EGSR

13        

14         GOPTIONS ACCESSIBLE;

15         %macro windowmacro;  /* Start the macro definition */

16        

17              %global a b;    /* Create global macro variables for use outside of macro */

18        

19              /* Set up window macro */

20              %window dataform color=white

21                   #2 @33 'Customized Data Entry Form' attr=(highlight,underline) color=blue

22                   #5 @19 'Enter the requested parameters in the table below:' attr=highlight color=blue

23                   #6 @25 '(Use the TAB key to jump to next cell)' color=blue

24                  

25                   #10 @3 'A:' @5 a 5 attr=underline required=yes

26                   #12 @3 'B:' @5 b 5 attr=underline required=yes

27        

28                   #15 @33 'Press ENTER to continue' attr=highlight;

29        

30              /* Run the window macro */

31              %display dataform;

32         %mend windowmacro;   /* Close the macro definition */

33        

34         /* call the macro */

35         %windowmacro;

ERROR: The MACRO windowing environment cannot be initialized due to a XU supervisor failure.

ERROR: The macro WINDOWMACRO will stop executing.

36        

37         /* create a dataset based on the macro variables created above */

38         data addcalc;

39              a=&a.;

                 _

                 22

40              b=&b.;

                 _

                 22

2                                         The SAS System          10:05 Tuesday, February 28, 2012

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,

              a numeric constant, a datetime constant, a missing value, INPUT, PUT. 

41              rslt=a+b;

42         run;

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.ADDCALC may be incomplete.  When this step was stopped there were 0

         observations and 3 variables.

WARNING: Data set WORK.ADDCALC was not replaced because this step was stopped.

NOTE: DATA statement used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

     

43         /* print the dataset */

44         proc print data=addcalc;

45         run;

NOTE: No observations in data set WORK.ADDCALC.

NOTE: PROCEDURE PRINT used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

     

46        

47        

48        

49         GOPTIONS NOACCESSIBLE;

50         %LET _CLIENTTASKLABEL=;

51         %LET _CLIENTPROJECTPATH=;

52         %LET _CLIENTPROJECTNAME=;

53         %LET _SASPROGRAMFILE=;

54        

55         ;*';*";*/;quit;run;

56         ODS _ALL_ CLOSE;

57        

58        

59         QUIT; RUN;

60        

djbateman
Lapis Lazuli | Level 10

Ashley,

Did you add any of the code above?  I did not write a lot of what is displayed there.  If you didn't add anything, then maybe something happened when I uploaded my SAS file.  I will just type out the code that I wrote here.  You can copy and paste it in a clean SAS editor window and see if you get any errors.

%macro windowmacro;  /* start the macro definition */

    %global a b;  /* create global macro variables for use outside of macro */

    /* set up window macro */

    %window dataform color=white

        #2 @33 'Customized Dta Entry Form' attr=(highlight,underline) color=blue

        #5 @19 'Enter the requested parameters in the table below:' attr=highlight color=blue

        #6 @25 '(Use the TAB key to jump to next cell)' color=blue

        #10 @3 'A:' @5 a 5 attr=underline required=yes

        #12 @3 'B:' @5 b 5 attr=underline required=yes

        #15 @33 'Press ENTER to continue' attr=highlight;

    /* Run the window macro */

    %display dataform;

%mend windowmacro;  /* close the macro definition */

/* call the macro */

%windowmacro;

/* create a dataset based on the macro variables created above */

data addcalc;

    a=&a.;

    b=&b.;

    rslt=a+b;

run;

/* print the dataset */

proc print data=addcalc;

run;

AshleyM
Fluorite | Level 6

I did not add anything to the code.

I just reran the code with what you've provided here in EG and still received the same errors.

djbateman
Lapis Lazuli | Level 10

Then I may not be able to answer your question.  I, unfortunately, never use Enterprise Guide.  I would not know why the code would run in a regular SAS editor for me but not in EG.  I just copied the code above and pasted it into my SAS editor, and my log comes out clean.  Have you tried using a SAS program editor instead of EG?

AshleyM
Fluorite | Level 6

I was just goign to mention the code works in SAS 9.2. However, it doesn't seem to generate a dataset.

Can you tell me if you can run this code here and whether or not you get a dataset?

%macro windowmacro/* start the macro definition */

    %global Docket Case_Type Event Start_time End_time;  /* create global macro variables for use outside of macro */

    /* set up window macro */

    %window dataform color=white

        #2 @33 'Customized Dta Entry Form' attr=(highlight,underline) color=blue

        #5 @19 'Enter the requested parameters in the table below:' attr=highlight color=blue

        #6 @25 '(Use the TAB key to jump to next cell)' color=blue

        #10 @3 'Docket:' @15 a 5 attr=underline required=yes

        #12 @3 'Case_Type:' @15 b 5 attr=underline required=yes

            #14 @3 'Event:' @15 b 5 attr=underline required=yes

            #16 @3 'Start_time:' @15 b 5 attr=underline required=yes

            #18 @3 'End_time:' @15 b 5 attr=underline required=yes

            #21 @33 'Press ENTER to continue' attr=highlight;

    /* Run the window macro */

    %display dataform;

%mend windowmacro;  /* close the macro definition */

/* call the macro */

%windowmacro;

/* create a dataset based on the macro variables created above */

data addcalc;

    Docket=&Docket.;

    Case_Type=&Case_Type.;

      Event=&Event.;

    Start_time=&Start_time.;

      End_time=&End_time.;

      Elapse_Time=End_time - Start_time;

run;

/* print the dataset */

proc print data=addcalc;

run;

djbateman
Lapis Lazuli | Level 10

I use SAS 9.1, so it should work there too.

You forgot to change the name of the macro variables in the %window macro.  Below is what the code should have for your case.  If you are not aware of the syntax for the %window macro, let me give you a brief explanation:

The # sign tells you what line in the window on which to display.

The @ sign tells you how many spaces in from the left border to move in.

The quoted text is what will appear when the %window macro is executed.

If you want to store a variable, then you need to specify where the user can start typing the value for the variable (using an @ sign) and how much space you want to give the user.  Thus, the following line:

    #10 @3 'Docket:' @15 Docket 5 attr=underline required=yes

means the following:

Start at line 10 and column 3 of the winow.  Print the text "Docket:".  Then on the same line but at column 15 store into the macro variable DOCKET a value of up to 5 characters.  The ATTR=UNDERLINE command says to underline those 5 allowable character spaces so the user knows where to enter the values.  The REQUIRED=YES command means that you cannot continue with the program until the user have entered a value for this variable.  You can change that to REQUIRED=NO (or simply omit this command since NO is the default) if the varable is not required.

Sorry to bog you down with a lot of information.  Here is your new code:

%macro windowmacro/* start the macro definition */

    %global Docket Case_Type Event Start_time End_time;  /* create global macro variables for use outside of macro */

    /* set up window macro */

    %window dataform color=white

        #2 @33 'Customized Dta Entry Form' attr=(highlight,underline) color=blue

        #5 @19 'Enter the requested parameters in the table below:' attr=highlight color=blue

        #6 @25 '(Use the TAB key to jump to next cell)' color=blue

        #10 @3 'Docket:' @15 Docket 5 attr=underline required=yes

        #12 @3 'Case_Type:' @15 Case_Type 5 attr=underline required=yes

            #14 @3 'Event:' @15 Event 5 attr=underline required=yes

            #16 @3 'Start_time:' @15 Start_time 5 attr=underline required=yes

            #18 @3 'End_time:' @15 End_time 5 attr=underline required=yes

            #21 @33 'Press ENTER to continue' attr=highlight;

    /* Run the window macro */

    %display dataform;

%mend windowmacro;  /* close the macro definition */

/* call the macro */

%windowmacro;

/* create a dataset based on the macro variables created above */

data addcalc;

    Docket=&Docket.;

    Case_Type=&Case_Type.;

      Event=&Event.;

    Start_time=&Start_time.;

      End_time=&End_time.;

      Elapse_Time=End_time - Start_time;

run;

/* print the dataset */

proc print data=addcalc;

run;

Cynthia_sas
SAS Super FREQ

Hi:

  I'm just curious. Where are you actually running the example? I would expect this to work in an interactive session of SAS, but fail in a batch submission or remote submit. Since your stored process code is submitted in batch mode and since your EG code is submitted in batch mode, I would expect eventual issues with the use of %window once you get done testing in interactive SAS:

http://support.sas.com/kb/10/201.html

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 9 replies
  • 2954 views
  • 1 like
  • 3 in conversation