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
7
votes
2 answers

How to use a .SAS or SPS metadata file to read a CSV as a Pandas dataframe?

I have a big CSV file and it comes with two metadata description files. One has a .sas extension and the other a .sps. Opening them, they describe the CSV data format and categories. The files describe the data format and possible categories of each…
neves
  • 33,186
  • 27
  • 159
  • 192
7
votes
1 answer

SAS reading bit data type in sql server 2005

I have a sql server 2005 database that has a table with a column of data type bit. When I look at the data in sql server management studio I see the column value as 0 or 1, when i pull with SAS I see 0 or -1, is like SAS is negating the 1 value. …
Haeflinger
  • 465
  • 1
  • 5
  • 15
7
votes
4 answers

How do I implement MVCC?

I have located many resources on the web giving general overviews of MVCC (multi-version concurrency control) concepts, but no detailed technical references on exactly how it should work or be implemented. Are there any documents online, or books…
jl6
  • 6,110
  • 7
  • 35
  • 65
7
votes
1 answer

SAS: How do I use ODS layout to put 8 graphs on 2 PDF pages?

I am using SAS ODS to create PDF documents. The code below works to put 4 graphs on 1 page. But if I try to put 8 graphs on 2 pages, all I get is 4 graphs on 1 page. I tried copying the part between the lines of asterixes and pasting it again above…
BB1
  • 95
  • 2
  • 4
7
votes
4 answers

SQL/SAS: Best performance for selecting from big table (2bn rows)

I have a non-indexed 2 billion rows table in a read-only SAS SPD server (bigtable). I have another 12 million rows table in my workspace (SAS_GRID) with a single column of unique ids (idlist). Both tables are updated constantly. I want to filter the…
Will Razen
  • 307
  • 1
  • 11
7
votes
1 answer

How to setup Apache Spark to use local hard disk when data does not fit in RAM in local mode?

I have 50 GB dataset which doesn't fit in 8 GB RAM of my work computer but it has 1 TB local hard disk. The below link from offical documentation mentions that Spark can use local hard disk if data doesnt fit in the…
GeorgeOfTheRF
  • 8,244
  • 23
  • 57
  • 80
7
votes
1 answer

convert numeric sas date to datetime in Pandas

I am using Pandas 0.18 and read_sas to load a sas7bdat dataset. The dates in the Pandas dataframe appear as: Out[56]: 0 19411.0 1 19325.0 2 19325.0 3 19443.0 4 19778.0 Name: sas_date, dtype: float64 pd.to_datetime does not…
ℕʘʘḆḽḘ
  • 18,566
  • 34
  • 128
  • 235
7
votes
1 answer

Difference between MISSING and NULL in SAS

In SAS, while using in a WHERE clause, is there any differnece between WHERE col1 is MISSING vs WHERE col1 is NULL Can you explain citing the case when col1 is char and when col1 is numeric?
Victor
  • 16,609
  • 71
  • 229
  • 409
7
votes
1 answer

Generate correlated random variables that follow beta distributions

I need to generate random values for two beta-distributed variables that are correlated using SAS. The two variables of interest are characterized as follows: X1 has mean = 0.896 and variance = 0.001. X2 has mean = 0.206 and variance = 0.004. For…
7
votes
2 answers

Changing Value of Macro Variable inside SAS macro

I am defining a macro variable inside a macro. Then, I am feeding it into a second macro. Inside macro2 counter changes value to 200. However, when I check what is inside the macro variable that I put in after macro 2 runs, it still says 0. I would…
DanRoDuq
  • 260
  • 3
  • 13
7
votes
2 answers

How do I stop SAS from adding an extra empty byte to every string variable when I use PROC EXPORT?

When I export a dataset to Stata format using PROC EXPORT, SAS 9.4 automatically expands adds an extra (empty) byte to every observation of every string variable. For example, in this data set: data test1; input cust_id $ 1 month …
Michael A
  • 4,391
  • 8
  • 34
  • 61
7
votes
3 answers

How to call one macro program from another in SAS Enterprise Guide?

Is there any macro command that allows calling one program from another (the %run_program() pseudo code)? Program "Settings": %let myvar="HELLO WORLD!"; Program "Program": %run_program(Settings); *Pseudo-code; %put &myvar; *Should print *Should…
Adam Ryczkowski
  • 7,592
  • 13
  • 42
  • 68
7
votes
3 answers

SAS : Convert character to numeric without creating another variable

I want to convert x to numeric. DATA test; input x $1.; cards; 1 2 0 ; run; I tried different ways : With *1 : /* trial1 */ DATA test1; SET test; x = x*1; run; The log prints the following note : NOTE: Character values have been…
Vincent
  • 955
  • 2
  • 15
  • 32
7
votes
1 answer

SAS. Why "Jan 11 2002" == "88399", according to documentation?

I was reading the dates documentation, but couldn't understand how SAS handled the dates: On SAS website they explain that Jan 1 1961 is 366, which makes sense : this is the number of days from Jan 1 1960. Further they convert Jan 11 2002 into…
Alex
  • 355
  • 7
  • 25
7
votes
2 answers

Could not allocate a new page for database because of insufficient disk space in filegroup

while running a program in SAS conected to SQL-server 2008 I am getting this ERROR in the log: Execute error: ICommand::Execute failed. : The statement has been terminated.: Could not allocate a new page for database 'databse'…
yke
  • 129
  • 3
  • 3
  • 10