sas

Compiling SAS SCL code programmatically

Is there a programmatic way of compiling SAS 9.1.3 SCL code (N.B. not ordinary SAS code) in Windows? The only way I have found of doing it involves using the SAS GUI: we have a Perl script which sends keystrokes to the UI. While this works (sort of), it's ugly and error-prone, and is too fragile to add to our automated build script. EDI...

How do I get SAS encoding option programmatically?

How do I find out the SAS global encoding option programmatically? I can run proc options, and it will give me the answer, but I need to do it from code. I am hoping for an answer on the lines of "look at the macro symbol &sysencoding", but this might be too much to hope for. I would prefer to avoid fragile things like writing to an ext...

Dropping a table in SAS

What is the most efficient way to drop a table in SAS? I have a program that loops and drops a large number of tables, and would like to know if there is a performance difference between PROC SQL; and PROC DATASETS; for dropping a single table at a time.. Or if there is another way perhaps??? ...

Why in SAS does a numeric literal in scientific notation give a different number to the number written out explicitly?

The following SAS code: data _null_; format t u best32.; t = 10000000000000000000000000; u = 1e25; put t u; if t ne u then put 'diff'; run; on my Windows machine prints out: 10000000000000000905969664 9999999999999998758486016 diff While I understand that only the first 15-16 digits are to be trusted, why do they give dif...

In SAS, what are good techniques/options for catching syntax errors?

In the enhanced editor, the coloring might give you a hint. However, on the mainframe I don't believe there is anything, in the editor, that will help you. I use OPTIONS OBS=0 noreplace; The obs=0 option specifies that 0 observarions are read in from the input dataset and NOREPLACE tells SAS not to overwite an existing SAS dataset ...

Syntax highlighting for multiple languages in same file: StatWeave/SAS/LaTeX

I am using StatWeave to run SAS code from within LaTeX files. I would like to be able to open a file in a text editor and view the main LaTeX document with LaTeX syntax highlighting and the embedded SAS "code chunks" with SAS syntax highlighting. (The "code chunks" are real (working) code, not just for display, so I don't think the LaTeX...

SAS row comparisons and queries? or other solution needed. I'm stumped.

I'm stumped. I have a situation where for each unique observation of casenum I would like to run varies queries and arithmatic operations between various observations of 'code' for that 'casenum' (see below). For example for casenum 1234567 I would like subtract data for code 0200 - code 0234 or 531 - 53. Please keep in mind that there a...

SAS BI Dashboard Feedback - What is your experience?

Backgroup: We are looking at SAS BI Dashboard. We have currently implemented almost all of SAS's other applications (with the exception of Enterprise Miner). Other technologies online include Business Objects, some custom reporting stuff, and Project R. The Question: What feedback do you have with: implementing SAS BI Dashboard buil...

SAS can I make sas process observations backwards

I know that Sas starts with the observation at the top of a dataset when processing and proceeds to the next until it reaches the bottom observation, but is there an easy way to make sas process the bottom observation first and then work its way to the top? ...

How do you assign the result of a macro function to a macro variable in SAS?

I have a macro that creates a timestamp (to append to output file names). However, rather than have to remember what macro variable the macro assigns the value to, I would prefer to assign a macro variable to the result of the macro (if that isn't circular enough). %let tms= %tms(); This is the current macro.... %macro tms ; %* C...

SAS Pocket Reference

I'm looking for a SAS pocket reference that provides listings of SAS procedures/statements. I don't want detailed explanations of each procedure - just a list of the procedures and maybe a short description to jog one's memory. A sublist of the statements associated with each procedure would be helpful. Something along the lines of the O...

Is it possible to do a case-insensitive DISTINCT with SAS (PROC SQL)?

Is there a way to get the case-insensitive distinct rows from this SAS SQL query? ... SELECT DISTINCT country FROM companies; The ideal solution would consist of a single query. Results now look like: Australia australia AUSTRALIA Hong Kong HONG KONG ... where any of the 2 distinct rows is really required One could upper-case the...

easy ways to create a summary variable in SAS

Hello programming guru's I am looking for an way to create a summary variable in SAS that will automatically add each row observation until a condition is met. I would need to be able to start and stop and reset this variable if necessary. Thanks a lot -sasnewbie ...

Calculating frequency of fractions in SAS

Hi, I'm trying to calculate the frequency of fractions in my data set (excluding whole numbers). For example, my variable P takes values 24+1/2, 97+3/8, 12+1/4, 57+1/2, etc. and I'm looking to find the frequency of 1/2, 3/8, and so on. Can anyone help?! Thanks in advance! Clyde013 ...

Calendar in SAS/AF

Hi all! I would like to know if there is anybody out there who has a calendar to be used in an AF-application, where it is possible to pick a specific date. Cheers Bill > Crossposted from SAS-L ...

ERROR: Insufficient page size to print frequency table in SAS PROC FREQ

Hi All, Could anybody tell me why does the compiler gives me an error - "ERROR: Insufficient page size to print frequency table." while running proc freq in sas. I am trying to run a very simple peice of code. proc freq data = seaepi; tables trt* sex/ out = temp; run; I really appreciate your effort involved. Thanks in advanc...

How do I remove HTML from the SAS URL access method?

What is the most convenient way to remove all the HTML tags when using the SAS URL access method to read web pages? ...

Flushing PDV variables

Is there a command or a quick way to set all the existing variables in the PDV to missing? I have some code which runs like this: Data example2; var1='A'; Var2='B'; Var3='C'; /* etc*/ output; Var1='B'; output; stop; run; once the first 'output' statement is reached I'd like to reset all the PDV variables to missing (eg var2=''; var3...

Floating Point Numeric - SAS decimal issue

Does anybody know what SAS format is needed in order to convert this string correctly? data _null_; x="0.14553821459"; y=input(x,best32.); put y=; run; ...

Help with Correlated Queries in SQL

Please help!! I am brand new to SQL programming and am teaching myself everything as I go along. I’ve finally run into a problem I can’t seem to tackle. Hopefully someone can help. I have the following tables. What I need to do is use the RECDATE in FROISEDI and count all the distinct dates (I4C7DZ) prior to and including that date ...