sas

Using Retain Statement for Mathematical Operations in SAS

I have a dataset with 4 observations (rows) per person. I want to create three new variables that calculate the difference between the second and first, third and second, and fourth and third rows. I think retain can do this, but I'm not sure how. Or do I need an array? Thanks! ...

Why does PROC FCMP function always return 33 bytes and no more?

I have the following function defined via PROC FCMP. The point of the code should be pretty obvious and relatively straightforward. I'm returning the value of an attribute from a line of XHTML. Here's the code: proc fcmp outlib=library.funcs.crawl; function getAttr(htmline $, Attribute $) $; /*-- Find the position of the ...

Treat missing values as zero in SAS where clause

Is there an equivalent of the Oracle NVL function in SAS? For example, if I have a where clause in SAS that says: where myVar > -2; it is not going to include any rows that have myVar = . If I want to treat missing values as zero, i have to say: where myVar > -2 or missing( myVar ) I'd like to be able to do something like: where...

SAS Proc SQL Database Table Insert

Using SAS's Proc SQL, is there a way to insert records from a SAS Dataset into a table in the open SQL Server connection? Something like this (which doesn't work): proc sql exec; connect to sqlservr as DataSrc (server=my-db-srvr database=SasProcSqlTest); create table Items as select * from connection to DataSrc ( SELECT * FROM ...

SAS DATE issue - calculating "NEAREST MONTH"

I need to calculate a figure which equates to the 'nearest' number of months between two dates. However the standard SAS function (INTCK) is not geared to consider the DAY of its date parameters (eg code below resolves to 0 when I need it to round to 1). What is the 'neatest' way of resolving this issue? data _null_; x="01APR08"d; y...

Password protection of SAS Code

Is there a way to password protect SAS CODE within SAS? Or, if not, what is the easiest / quickest way to apply some kind of password protection? I am referring to scripts run from local Windows PCs (ie not batch). The scripts are stored on a standard network drive... (Ideally the solution would not involve a Microsoft product such a...

Career Changer -- hoping for SAS analyst position

I'm a career changer (with only an academic background in IT-related areas) looking to break into the SAS programming/analyst world. My primary preference would be to work in a financial analysis position, but would definitely not be hesitant about working in the pharm. industry. I will be sitting for the "Base Programming for SAS 9" c...

Can SAS convert CSV files into Binary Format?

The output we need to produce is a standard delimited file but instead of ascii content we need binary. Is this possible using SAS? ...

SAS error message (FATAL: Code generation error detected during MISSING smear generation)

Does anyone know what this error message means? FATAL: Code generation error detected during MISSING smear generation. It occurs whilst concatenating approx 40 datasets. I believe it may be due to hitting memory limits from having too many variables (circa 217), but would be good to get confirmation of this... (log file) 301 Data &d...

Loading data from SAS to Teradata - When is it ready?

When loading tables from SAS to Teradata, SAS loads the data (usually using the FASTLOAD facility) and then continues down the script. However, I often get critical errors because SAS says the data is loaded, but Teradata is still assembling the data within the table. So the data is in the database, but not ready to be used. I have yet...

Sas Delimiting Character

We are loading a Fixed width text file into a SAS dataset. The character we are using to delimit multi valued field values is being interpreted as 2 characters by SAS. This breaks things, because the fields are of a fixed width. We can use characters that appear on the keyboard, but obviously this isn't as safe, because our data could ...

Proc SQL Delete takes WAY too long

I'm running the following SAS command: Proc SQL; Delete From Server003.CustomerList; Quit; Which is taking over 8 minutes... when it takes only a few seconds to read that file. What could be cause a delete to take so long and what can I do to make it go faster? (I do not have access to drop the table, so I can only delete all rows) ...

SAS error - Incomplete termination for SASHELP.FSP.VTMAIN.FRAME:

Can anyone explain what the following error message means? It occurred after the following: 1 - Leaving the (BASE SAS) session open overnight 2 - This morning the first thing I did was close a single table that had also been left open (by clicking on the X button) 3 - A pop up error box then appeared (don't remember what it said but ...

Referencing a remote SAS work library from another session

Ever had a problem with a SAS session, but been unable to close the session due to having critical files in your remote work library (RWORK)?? I certainly have! So how do you access that library from another (new) session? ...

sas date - convert today() into yyyymmdd format..

How do I convert a SAS date such as "30JUL2009"d into YYYYMMDD format (eg 20090730) ?? so for instance: data _null_; format test ?????; test=today(); put test=; run; would give me "test=20090730" in the log.... ...

SAS printing to file

I have a SAS file handle created as such: filename filehandle "report.htm"; I have several files (packed Javascript files) which have very long lines (>32K in length). I would like a way to append their contents to the file above. I know that if I do: data _null_; file filehandle; put "very long string here"; run; Sometime...

SAS Display Manager commands

The SAS display manager is a comamnd line interface to the SAS system, which remains in Base SAS as a legacy facility. However the online documentation on how to use this facility is sparse at best, and google searches are less than fruitful. A common DM command would be: CLEAR LOG; CLEAR OUTPUT; WPGM; My question is - What other DM...

SAS DM 'close table'

to open a table in SAS we can use the DM "VT {tablename}" command. What is the equivalent command to CLOSE the viewtable window??? ...

Unit Testing Frameworks in SAS: FUTS vs. SASUnit

Dear Stackoverflow, Does anyone have experience using a third-party unit testing framework for SAS such as FUTS (http://www.thotwave.com/products/futs.jsp) or SASUnit (http://www.redscope.org/sasunit/en)? I'd really like to compare and contrast these options with each other and with any other known alternatives (I currently use my own ...

SAS to Oracle ODBC - passing a SAS table INTO the database

Can anyone please advise the syntax for passing a table FROM a SAS library INTO an oracle database? example code below (although obviously the connection to the WORK library cannot be referenced in this way) PROC SQL noprint; connect to ODBC as X (dsn='ALIAS' uid='USER1' pwd='passwd' quote_char=''); exec (CREATE TABLE Test AS SELEC...