Questions tagged [sas]

The SAS language is a 4GL that underpins the SAS system, a suite of products centered around data processing and statistical procedures. For questions about code, please include your code and some data to reproduce your problem, either in datalines/cards statements or using a sashelp dataset like sashelp.class or sashelp.cars.

The SAS System is a proprietary suite of products used for business intelligence, data warehousing, data processing, and statistical analysis, across many industries, but particularly pharmaceuticals, finance and telecoms. It is available for (and often acting as a bridge between) mainframe, UNIX, Linux and Windows platforms.

The SAS System is a 4th generation programming environment, in that it includes a fully featured GUI with many user tasks able to be accomplished without coding. The SAS language itself is more powerful than the typical query language available in 4GLs, being more similar to a scripting language such as Python combined with built-in SQL and SQL-type queries.

SAS programs typically consist of two types of steps: data steps and proc steps. A data step creates a new data file or modifies an existing data file. Data steps can also serve to create user reports. Proc steps allow users to analyze data and provide user reports, such as summary statistics, charts of data, and correlations between variables. In addition SAS has ODS for Output in various formats like html, excel and pdf.

SAS also includes a macro language (also found in ) to conditionally control program code and improve readability.

SAS University Edition is an academic and free download for the SAS language available at http://support.sas.com/software/products/university-edition/

Questions about SAS that are on topic are questions about programming in SAS (writing code), questions about interacting with the programming environments related to SAS (Base SAS, Enterprise Guide, SAS Studio), or questions about SAS-related tools that are used in conjunction with programming (such as the prompt interface used in a programming context).

Questions about various SAS visual tools (such as SAS Visual Analytics) that are not used in conjunction with user written code, even if they could be used with writing code, are not on topic, nor is server administration. Please find appropriate communities for those questions, or the SAS community forums for any SAS related question that does not fit well here.


Well written SAS questions will include complete code to reproduce any issue you are having, and data to go with that code. Either use sashelp datasets (sashelp.class or sashelp.cars for example), or input your own data using a datalines statement, like so:

data have;
 input x y z;
 datalines;
1 2 3
4 5 6
7 8 9
;
run;

Examples of good questions that include datalines include How to use Boolean datatype in SAS? and PROC Report, multiple columns with same statistic. Examples of good questions using sashelp datasets include substr function with macro variable name and using where in sas macro when subsetting dataset.


Vendor website

15658 questions
11
votes
3 answers

SAS memory usage and sorting

I'm curious about SAS's use of memory, sorting, and why it seems to be so inefficient. I have a quad core xeon with 8GB ram. I have a 3GB dataset. Why, at any given time during a standard proc sort, is a mere 120MB of ram being used and a meager…
user571730
  • 176
  • 1
  • 5
11
votes
3 answers

How compatible is WPS with SAS?

How compatible is the WPS SAS-clone with the corresponding products from SAS Institute? Has anyone tried it - if so: have you run into any compatibility issues?
Troels Arvin
  • 6,238
  • 2
  • 24
  • 27
11
votes
5 answers

How to convert sas7bdat file to csv?

I want to convert a .sas7bdat file to a .csv/txt format so that I can upload it into a hive table. I'm receiving the .sas7bdat file from an outside server and do not have SAS on my machine.
Ashpreet Bedi
  • 141
  • 1
  • 1
  • 5
11
votes
5 answers

Is it possible to loop over SAS datasets?

I have 60 sas datasets that contain data on consumers individual characteristics such as id, gender, age, amountSpent, .... Each dataset shows data only for one time period (data1 is Jan, data2 is Feb...). I cannot merge them because of the size…
Buras
  • 3,069
  • 28
  • 79
  • 126
10
votes
2 answers

R glm standard error estimate differences to SAS PROC GENMOD

I am converting a SAS PROC GENMOD example into R, using glm in R. The SAS code was: proc genmod data=data0 namelen=30; model boxcoxy=boxcoxxy ~ AGEGRP4 + AGEGRP5 + AGEGRP6 + AGEGRP7 + AGEGRP8 + RACE1 + RACE3 + WEEKEND + SEQ/dist=normal; FREQ…
Michelle
  • 1,281
  • 2
  • 16
  • 31
10
votes
8 answers

How to remove duplicated records\observations WITHOUT sorting in SAS?

I wonder if there is a way to unduplicate records WITHOUT sorting?Sometimes, I want to keep original order and just want to remove duplicated records. Is it possible? BTW, below are what I know regarding unduplicating records, which does sorting in…
mj023119
  • 675
  • 5
  • 12
  • 19
10
votes
7 answers

How to find SAS version from SAS Enterprise Guide?

In my previous work place where I had access to base SAS (running SAS interactively on the server directly), I could find out the current SAS version easily (from the SAS log) by issuing the code proc setinit; run; In my new work place there is no…
Atlas7
  • 2,726
  • 4
  • 27
  • 36
10
votes
2 answers

Why won't my macro variable resolve?

I have a macro variable, &myvar, but it won't resolve when I try to put it in a data step variable. Why won't it, and what can I do to fix this? %let myvar=Hello, world; data _null_; x='&myvar.'; put x=; run;
Joe
  • 62,789
  • 6
  • 49
  • 67
10
votes
1 answer

Exporting a txt file with line record length greater than 32767 characters?

I have been trying to export a SAS data set with 49 variables. Each of these variables can potentially be 32767 characters long. I want to write this data set to a txt file, but SAS limits me with the lrecl option at 32767 characters. Is there a…
Mark Nielsen
  • 991
  • 2
  • 10
  • 28
10
votes
1 answer

sas MACRO ampersand

%let test = one; %let one = two; %put &test; %put &&test; %put &&&test; %put &&&&test; %put &&&&&test; Well. I'm TOTALLY BEATEN by these ampersands. I don't understand why they need SO MANY ampersands before a macro variable. Is there any trick to…
zhuoer
  • 617
  • 1
  • 7
  • 15
10
votes
2 answers

Converting large SAS dataset to hdf5

I have multiple large (>10GB) SAS datasets that I want to convert for use in pandas, preferably in HDF5. There are many different data types (dates, numerical, text) and some numerical fields also have different error codes for missing values (i.e.…
vgregoire
  • 139
  • 8
10
votes
3 answers

Stop SAS execution

Quick question Is there a one-liner (or something rather short) method of cancelling the execution of further SAS statements from withing the windowing environement. These are the methods I know of but they get tiresome, espeacially in huge…
Pane
  • 555
  • 2
  • 7
  • 20
10
votes
4 answers

How to delete blank observations in a data set in SAS

I want to delete ALL blank observations from a data set. I only know how to get rid of blanks from one variable: data a; set data(where=(var1 ne .)) ; run; Here I set a new data set without the blanks from var1. But how to do it, when I want to…
user1626092
  • 499
  • 4
  • 11
  • 23
10
votes
5 answers

How can I make a character variable equal to the formatted value of a numeric variable for arbitrary SAS formats?

If I have a numeric variable with a format, is there a way to get the formatted value as a character variable? e.g. I would like to write something like the following to print 10/06/2009 to the screen but there is no putformatted() function. data…
Simon Nickerson
  • 42,159
  • 20
  • 102
  • 127
10
votes
2 answers

Unit Testing Frameworks in SAS: FUTS vs. SASUnit

Does anyone have experience using a third-party unit testing framework for SAS such as FUTS (http://thotwave.com/resources/futs-framework-unit-testing-sas/) or SASUnit (http://www.redscope.org/sasunit/en)? I'd really like to compare and contrast…
Matthew Nizol
  • 2,609
  • 1
  • 18
  • 22