philihp.com

Tag: SAS

Converting between Date and Datetime in SAS

In SAS, fields are either character of varying length, or numeric. No exceptions. Temporal values such as Date and Date/Time are stored as either the number of days or seconds since 1960 January 1st. In order to convert from Date/Time to Date, and from Date to Date/Time, you could divide or multiply respectively by 86400 [...]

Installing SAS 9.1.3 on Ubuntu Linux 8.10

It works. Just follow the instructions.

Installing SAS 9.1.3 on OpenBSD 4.3

It does not work.

Avoid Correlated Subqueries

If your SQL code has a nested select that references a column in an outer select, such as the following, it may be possible to rewrite to perform orders of magnitude faster. proc sql; create table new_rates as select from work.exchange_rate n where not exists( select from imf.exchange_rate o where n.effective_date=o.effective_date and n.iso_char_code=o.iso_char_code ); NOTE: [...]

SAS Encoding Libname Option

So my coworker was having a problem where he was reading a dataset that he did not own. It was a SAS9 dataset encoded in UTF-8, and contained ™ (U+2122), the trade mark sign. His SAS session was running a local encoding of latin1, ISO_8859-1, which did not have it. My instinct says, it should [...]

Changing a SAS Dataset’s Encoding

In SAS9, every dataset should have an “encoding” property that specifies the charset of the bytes in its character variables. You can manually set this without having SAS try to transcode it into a new encoding by using a proc datasets modify. data work.src(encoding=’any’); length s $20; s = ’6E756C6C’x; output; s = ‘C3B1C3BC6C6C’x; output; [...]