I am new to SAS/AF and SCL , i am trying to build Simple applications while learning,
however when I enter a code in SCL with works fine with the Version 6 Objects but not for the latest components.
Here is the SCL code
INIT:
return;
BUTTON:
SUBMIT CONTINUE;
proc print data=&datatable;
run;
ENDSUBMIT;
RETURN;
TERM:
Return;
This works fine for Input Field, which is Version 6 but not for the Text Entry Control
The error I get is when I enter sashelp.class is
NOTE: SCL source line.
17 proc print data=4427;
----
22
200
ERROR 22-322: Expecting a name.
ERROR 200-322: The symbol is not recognized and will be ignored.
18 run;
ERROR: File WORK.NAME.DATA does not exist.
What is missing in the SCL script for the newer objects?
Submit replacement
In Version 6 the submit replacement for an &ObjectName is its value.
In Version 8+ the submit replacement for a &ControlName is its reference id, thus you get 4427 or whatever it is a frame runtime.
Change submit code in the button handler to reference the text attribute of the control in order to replace it with the attribute value.
proc print data=&datatable.text;
run;
Related
I got it by chance.
Submit this to SAS:
proc toolbar;
quit;
The Log says:ERROR: Unable to open ..., I think it indicates proc toolbar is some kind of procedure but I just didn't use correct syntax. Because if there is not a procedure named toolbar it would be another kind of hint: ERROR: PROCEDURE XXX not find. You can validate it using the following example.
proc XXX;
quit;
I dont't find any documents about proc toolbar. How do you know about it? could you please share with me?
Currently, custom toolbars for SAS display manager sessions are created using the display manager command TOOLDEF and loaded (or attached) to a window using command TOOLLOAD.
Proc TOOLBAR may be a deprecated or an abandoned experimental procedure that is for programmatically creating custom toolbars.
As for
ERROR: Unable to open ...
The mystery of what ... is remains.
Attempts to specify a procedure option produces a log message
ERROR 22-322: Expecting ;.
So maybe the procedure does not allow options.
The procedure does process an ITEM statement that was likely the syntax for associating an entry with a command and icon
item <name> command="<command>" icon=<icon-number>
Every attempt to run Proc TOOLBAR will create a new temporary catalog in the WORK folder.
proc toolbar cat=work.play.one;
item work command="dir work" icon="123";
item view command='viewtable &syslast';
quit;
Aside for icons
The SAS display manager command regedit raises the SAS registry editor window. Icon numbers for various classifier mnemonic can be seen in the drill path SAS_REGISTRY/CORE/CLASSIFIERS and for SAS explorer at SAS_REGISTRY/CORE/EXPLORER/ICONS. The SAS registry editor does not display the icon image that corresponds to the icon number.
Example:
Classifier 100 is named COPYITEM and will show icon #173 in the display manager UI. The datatype of the names are strings as shown by the preceding [ab] icon.
However, you can download and run an improved registry viewer application built with SAS/AF that does show icon images adjacent to icon numbers.
See page "SAS/AF Registry Browser" for information about the viewer application. The viewer can be installed and run by submitting
LIBNAME EXAMPLE "%sysfunc(pathname(WORK))";
filename INSTALL
URL "https://www.devenezia.com:443/downloads/sas/af/example/registry-browser/registry-browser.xpt"
;
PROC CIMPORT LIB=EXAMPLE FILE=INSTALL;
RUN;
filename INSTALL;
proc display cat=EXAMPLE.REGISTRY.BROWSER.FRAME;
run;
Other interesting artifacts from bygone days
Proc PMENU
SAS Explorer use and customization
There are a number of procs in SAS that are dead/defunct. They are normally very hard to find info on. A few years ago, with some sleuthing, I got proc explode to work. An old procedure to write large letters on greenbar back in the mainframe printer days. I am sure there are many, many more. I think I remember proc toolbar but has been 20+ years. Maybe an AF proc when SAS was on the old editor.
Honestly, I would ignore it as having any value. I suspect dozens of abandoned procs in the code base.
I switched from SAS to R years ago. However, someone recently gave me a SAS file I hope to translate to R. I have discovered SAS has changed so much over the years that I cannot even figure out how to display the results of a print statement.
Here is a simple SAS file:
data a;
input group x;
cards;
1 12
1 14
1 16
2 11
2 13
2 15
;
proc print;
var group x;
run;
If I copy and paste the above code into SAS 9.4 on a Windows desktop nothing appears in the Log window, nothing appears in the Output window and nothing appears in the Results window.
By the way, I have clicked the Create Listings option under: Tools> Options> Preferences> Results>
I suspect the current version of SAS requires that I provide some sort of code in addition to checking the box next to Create Listings before SAS will display results in the Output window, but I do not know what that line of code must be.
How can I view the results in the Output window like I used to do with SAS years ago? Thank you for any advice. I cannot imagine a more basic question and apologize if this is a duplicate.
Try explicitly telling SAS to use the listing Window.
ods listing;
If you are using SAS Enterprise Guide you need to run your code via F8, this will then display your results in the results page
I've used this forum to gather information on creating and using prompts in SAS EG tasks and queries. However, I can't seem to transfer my own syntax from Base SAS, incorporate/reference prompts/macros I've created, and get it to work.
Currently, everytime I reference a prompt in my own program (rather than one generated by point-click selections in SAS EG) the log tells me SAS can't resolve the macro reference.
How can I transfer my own program into SAS EG and then integrate the prompts?
Example code I used to develop test data set:
data work.testscores;
input Gender $ 1-6 SATScore 8-11 IDNumber 13-20;
datalines;
Male 1170 61469897
Female 1090 33081197
Male 1240 68137597
Female 1490 9589297
Male 1200 93891897
Female 1080 26212897
Male 1050 8945097
Female 1200 51799397
Male 1600 39196697
;
run;
/created Genders prompt in the prompt manager using gender variable/
PROC SQL;
CREATE table WORK.testscores2 as
SELECT &Genders, SATScore
FROM WORK.TESTSCORES
;
QUIT;
Log:
102 PROC SQL;
103 CREATE TABLE WORK.TESTSCORES2 AS
104 SELECT &Genders
WARNING: Apparent symbolic reference GENDERS not resolved.
104 SELECT &Genders
_
22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT,
SUBSTRING, USER.
105 FROM WORK.TESTSCORES;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
106 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Thanks,A
Judging by the comments of the topic starter, it looks like there is some misunderstanding how prompts in EG work. It's not a tool for assigning value to some macrovariable BEFORE running your program. 'Prompt' implies that the program prompts you to enter the value DURING the program running. But for that, you have to assign your prompt to coressponding program, so that when you run this particular program SAS would envoke this particular prompt. For that: right click on the task -> Properties -> Prompts -> Add.
I dont understand what you want to achieve by your code. Do you want select just male or female SAT-scores based on the value of the macro variable you set in the prompt?
proc sql;
create table work.testscores2 as
select gender, satscore
from work.testscores
where gender = &genders.;
/* Where the value of &genders is either 'Male' or 'Female' */
quit;
To use a macro variable created in a prompt, you need to check the box "Use prompt value throughout project".
I am using Enterprise Guide 4.2 (no choice about this).
I am using PROC APPEND to append about 80k+ observations to a SQL Server table. I believe that there are some issues with the format of the data (such as mismatching variable lengths), but it executes just fine and the table is updated. Then, Enterprise Guide gives me the following message:
The contents of Log(af771r01 (Process Flow)) is too large to display. The window will close, but the contents will remain in the project.
I was able to successfully disable the log by redirecting it to a dummy file:
** The Append Proc below outputs 80k+ lines (in theory) to the log, crashing EG 4.2;
** This statement will temporarily disable logging;
FILENAME JUNK DUMMY;
PROC PRINTTO
LOG=JUNK;
RUN;
** ========================================================
** Archive Summarized Enrollment Data
** ========================================================;
PROC APPEND BASE = Archive.MnthlyMbrCmpArch (
SASDATEFMT=(SYS_SRC_LOAD_DT='mmddyy10.')
)
DATA = Work.R1_MBR_ENRL_ARCHIVE;
RUN;
** Reenable logging;
PROC PRINTTO;
RUN;
This prevents EG from crashing, but I'm losing all of the warning and error messages. I am trying to debug the statement so I want the warnings and errors, I just don't want a flooded log.
Is there a way to partially disable logging without turning it off completely? Or is there a way to redirect the log to a file so that EG doesn't crash while trying to not open it?
I am new to SAS and am open to any suggestions, even if they do not directly answer the question.
Yes, you can redirect the log to a file by specifying a path in the FILENAME statement (instead of saying DUMMY, which refers to a non-existing file):
FILENAME JUNK 'path/file-name.log';
Of course, you must have "write" permission to the location you specify.
You can suppress a lot of information from the log by using:
options nonotes nonotes2;
And/or:
options nomprint nomlogic nosymbolgen nomacrogen; /* IF CODE CONTAINS MACROS */
Errors will still be printed to the screen but you would have little information to debug them unless you turned the logging back on.
Some SAS Documentation: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001906177.htm
I have a SAS program that loops through certain sets of data and generates a bunch of reports to an ODS HTML destination.
Sometimes, due to small sets of data I run these reports for, a certain PROC REPORT will not generate because, for this set of data I'm on, there is no data to report. I get this message for those instances:
WARNING: A GROUP, ORDER, or ACROSS variable is missing on every observation.
What I want in the HTML is to display some sort of message for these like "did not generate" or something.
I tried to use return/error codes or the warning text above to detect this, but the error code is 0 (no problem, really?) and the warning text doesn't reset if the next PROC REPORT generates OK.
If it is of any importance, I'm using a data step with CALL EXECUTE to get all this PROC REPORT code generated for these sets of data.
Is there any way to generate this "did not generate" message or at least to catch these warnings per PROC REPORT?
You can substitute in a value for the missing observations in your report.
First redefine missing values to some character. I think you can only use a single character, I could be wrong, though.
options missing='M';run;
Then make sure to use the "missing" option in your PROC REPORT.
proc report data=somedata nowd headline missing;
....
run;
EDITS BASED ON COMMENTS
To get comments to show up, I see a few possibilities.
One, scan the the data set and check for missing values. If any are present throw a message out.
Data _Null_;
Set dataset;
file print notitles;
if obs = . then do;
put #01 'DID NOT COMPUTE';
stop;
end;
run;
Two, add a column with a compute:
define xx /computed "(Message)";
compute xx /char length=16 ;
if obs =. then xx = 'did not compute value in row';
Three, a conditional line using compute:
compute after obs;
if obs = . then do;
line #1 "DID NOT COMPUTE";
end;
endcomp;
endcomp;
See: http://www2.sas.com/proceedings/sugi26/p095-26.pdf
Look for the MTANYOBS macro and the section on printing a 'no observations' page.