62 Answered Questions for the topic SAS

04/28/19

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... more

04/28/19

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": ... more

04/28/19

Sorting an almost sorted dataset in SAS?

I have a large dataset in SAS which I know is almost sorted; I know the first and second levels are sorted, but the third level is not. Furthermore, the first and second levels contain a large... more
Sas Sql

04/27/19

Join overlapping date ranges?

I need to join table A and table B to create table C. Table A and Table B store status flags for the IDs. The status flags (A_Flag and B_Flag) can change from time to time, so one ID can contain... more
Sas

04/26/19

SAS: rearrange field order in data step?

In SAS 9, how can I in a simple data step, rearrange the order the field. Data set2; /*Something probably goes here*/ set set1; run; So if set1 has the following fields: Name Title Salary ... more
Sas

04/24/19

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 =... more
Sas

04/23/19

Opening SAS datasets for viewing from within a .sas program?

Is there a way to open a SAS dataset for viewing (i.e., in the "ViewTable" window) from within a .sas file?

04/23/19

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... more
Sas

04/23/19

In SAS, what is the difference between Proc Means And Proc Summary?

What exactly is the difference between Proc Means and Proc Summary? Many sites state that both these are same, but unless each has something unique will SAS create it?
Sas Sas Macro

04/22/19

For in loop equivalent in SAS 9.3?

I'm searching for a while an equivalent of the ***for in* loop** (like in [Python][1] or in R) in SAS 9.3 macro language. The [DO loop][2] seem's to be the solution but did't work exactly as I... more
Sas Sas Macro

04/22/19

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... more
Sas

04/22/19

Quit vs Run statements in SAS?

In SAS, what is the difference between 'quit' and 'run'? statements? I cannot figure out when to use 'quit' and when to use 'run'? For example, why is `proc datasets` using `quit` but `proc... more
Sas Sas Macro

04/22/19

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... more
Sas

04/21/19

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... more
Sas

04/21/19

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... more

04/20/19

Open SAS .egp file to view code witout having SAS installed?

is there any solution to open SAS .egp file without having SAS installed on my pc? i need to open project.egp to check my old code but i dont have SAS anymore so is there any other way to do that?

04/20/19

sas informat datetime?

Can anyone advise on the appropriate SAS informat to read in a datetime (dd/mm/yyyy hh:mm) ??? eg data _null_; informat from_dt datetime????.; input from_dt ; put from_dt=; cards; ... more
Sas

04/20/19

What is the difference between SAS functions and procedures?

04/20/19

Do I need to call rollback if I never commit?

I am connecting to a SQL Server using no autocommit. If everything is successful, I call commit. Otherwise, I just exit. Do I need to explicitly call rollback, or will it be rolled back... more
Sas

04/20/19

how to concatenate each record within one observation in SAS?

I wonder whether it's possible to concatenate each record within one observation with SAS code. E.g. Here is the original data set **1st_name 2nd_name 3rd_name .....last_name** abc def ghi... more
Sas

04/20/19

How can I read a SAS dataset?

I have a lot of files in SAS format, and I'd like to be able to read them in programs outside of SAS. I don't have anything except the base SAS system installed. I could manually convert each one,... more
Sas Proc Sql

04/19/19

Limiting results in PROC SQL?

I am trying to use PROC SQL to query a DB2 table with hundreds of millions of records. During the development stage, I want to run my query on an arbitrarily small subset of those records (say,... more
Sas Sql Regex

04/19/19

Finding strings that differ with at most one letter from a given string in SAS with PROC SQL?

First some context. I am using proc sql in SAS, and need to fetch all the entries in a data set (with a couple of million entries) that have variable "Name" equal to (let's say) "Massachusetts". Of... more
Sas

04/19/19

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... more
Sas Sql

04/17/19

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... more
1 3

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.