logo
down
shadow

SAS QUESTIONS

Null Columns only based on a variable value - SAS Dataset
Null Columns only based on a variable value - SAS Dataset
should help you out There are 2 parts to the question I think. First is to subset records where Reported = "N". Then among those records, report columns that have all missing values. If this is correct then you could do something as follows (I am ass
TAG : sas
Date : January 10 2021, 02:06 PM , By : pcoramc
Setting all array values to a single value
Setting all array values to a single value
I wish did fix the issue. You have 100*NOBS assignments to do. Don't see how using a DO loop over an ARRAY is any more inefficient than any other way. But there is no need to do the calculation when you know it will not be needed.
TAG : sas
Date : January 10 2021, 02:06 PM , By : sadboy
Formatting in SAS to Create Buckets
Formatting in SAS to Create Buckets
seems to work fine I use the following code to bucket my continuous variable in SAS, but it does not work: , You are just not setting the dataset - rather creating a new one.
TAG : sas
Date : January 02 2021, 06:48 AM , By : barefootChild
Reading large MSSQL tables from SAS efficiently
Reading large MSSQL tables from SAS efficiently
Any of those help BULKLOAD=yes is for uploading data from SAS. Reading data into SAS should not require special flags.47 GB in two hours seems slow, but I'm not sure if you'll find someone who's willing to help you troubleshoot it in an online forum.
TAG : sas
Date : January 02 2021, 06:48 AM , By : Francesco
Transposing a complex data set in SAS
Transposing a complex data set in SAS
should help you out Complex transformations usually involve more than one TRANSPOSE or DATA steps with arrays. Sometimes an overly complex transformation is a hint that what is really needed is a reporting procedure such as tabulate or report instead
TAG : sas
Date : January 02 2021, 06:48 AM , By : sam
Can input function take a macro variable as character argument?
Can input function take a macro variable as character argument?
Does that help The macro processor just replaces the macro reference with the resolved text and then the generated text is interpreted as text. So when you tried.
TAG : sas
Date : January 02 2021, 06:48 AM , By : omaidog
How to read data from data file using infile statement?
How to read data from data file using infile statement?
hope this fix your issue There are 3 things you need to do: Make sure that the folder you put the dataset in is accessible to the SAS University Edition VM. Did you follow the setup guide in full? Usually that directs you to set up a folder that beco
TAG : sas
Date : January 02 2021, 06:48 AM , By : oiyto
Weight in Proc TABULATE Has No Effect
Weight in Proc TABULATE Has No Effect
like below fixes the issue From my reading of the docs, in PROC TABULATE the WEIGHT statement specifies weights for analysis variables, i.e. variables listed on a VAR statement.You don't have any analysis variables, you only have class variables.
TAG : sas
Date : January 02 2021, 06:48 AM , By : KaoFloppy
Find the prime DATE
Find the prime DATE
will help you So there was just a discussion about how to generate prime numbers using Sieve of Eratosthenes method. So we can first run that and then loop over the dates and convert them into the series of numbers and check if they are primes.
TAG : sas
Date : January 02 2021, 06:48 AM , By : Justin Bowers
SAS How to extract a single string before a specific string?
SAS How to extract a single string before a specific string?
I wish this helpful for you I'm trying to extract the number n before a string: , So, it's time for regular expression.
TAG : sas
Date : January 02 2021, 06:48 AM , By : brij
How Do I Write A Do-Loop That Creates A Graph For Each Unique Person?
How Do I Write A Do-Loop That Creates A Graph For Each Unique Person?
help you fix your problem In SAS, the doing something for each concept is typically serviced via the BY statement. The Proc will perform the operations you expect and automatically process the data group-wise according to the distinct values of the b
TAG : sas
Date : January 02 2021, 06:48 AM , By : geo
SAS data set "nonexistent"?
SAS data set "nonexistent"?
this will help Member names in SAS must be valid SAS names. So you couldn't name your dataset 1979data.sas7bdat. You can relax some of the restrictions by setting the option VALIDMEMNAME to EXTEND and using name literals in your SAS code. But also no
TAG : sas
Date : January 02 2021, 06:48 AM , By : ranja
Insert into function with SAS/SQL
Insert into function with SAS/SQL
it helps some times Date literals (constants) are quoted strings with the letter d immediately after the close quote. The string needs to be in a format that is valid for the DATE informat.
TAG : sas
Date : January 02 2021, 06:48 AM , By : goffi
Prevent SAS to automatically remove trailing blank in string
Prevent SAS to automatically remove trailing blank in string
I hope this helps . I didn't quite understand what you are trying to do with ksubstr, but if you want to add padding to get the total length to 20 characters, you may have to write some extra logic:
TAG : sas
Date : January 01 2021, 06:10 PM , By : John R
Merging as of a date
Merging as of a date
I think the issue was by ths following , I am trying to merge two tables. table A has an id column, a date column, and an amount value for every date in a period , This will work for the question you have asked literally:
TAG : sas
Date : December 28 2020, 06:11 AM , By : shenol
compute variable after datalines
compute variable after datalines
should help you out Datalines appears at the end of the data step. Your computation statements should be placed before datalines, after the input
TAG : sas
Date : December 27 2020, 02:58 PM , By : Ivan Kitanovski
Generate multiple lags through loops in SAS?
Generate multiple lags through loops in SAS?
seems to work fine You would have to maintain your own array of mv values and assign the lag values from that. The array would be bubbled for each row processed and reset at the start of an fyear group.Example:
TAG : sas
Date : December 26 2020, 03:01 AM , By : Vodkat
Creating Columns From Stacked Data
Creating Columns From Stacked Data
I wish this helpful for you I cannot think of a way to generate this report using just one PROC. You will need to do some post processing of PROC MEANS or PROC SUMMARY results to get to this:
TAG : sas
Date : December 25 2020, 04:01 PM , By : Doc Immortal
PROC LOESS with option MAXPOINTS = NONE
PROC LOESS with option MAXPOINTS = NONE
should help you out I doesn't mean that it used only 9 points in estimating. In essence what it indicates is the optimal number of points required to come up with the fit. It is likely that your smoothing factor is too high or your data really is tru
TAG : sas
Date : December 25 2020, 12:31 PM , By : Jonathan
SAS macro variable containing two macro variables is not resolved
SAS macro variable containing two macro variables is not resolved
With these it helps Macro triggers are not resolved inside of single quotes. One easy way is to use double quote characters instead, remember to double any embedded double quote characters.Note there is no need to use CATS() in macro code. Or add %ST
TAG : sas
Date : December 25 2020, 09:33 AM , By : user118656
Retain and Keep Variables Macro
Retain and Keep Variables Macro
Any of those help Why a macro? They way you use a macro "function" hardly reduces the code and makes it harder to read. It is easyer to use a macro variable.
TAG : sas
Date : December 25 2020, 03:01 AM , By : Don Changer
Macro to Include Based on Variable Record Names
Macro to Include Based on Variable Record Names
Hope this helps I think a brief study of SAS datastep and macro may help you since you have it a bit confused. Remember, anything that goes inside a macro gets resolved during compile time and output is actually code that gets executed during runtime
TAG : sas
Date : December 24 2020, 03:01 AM , By : Jµ.
How to generate new import code following a structure change in an upstream flat file without headers?
How to generate new import code following a structure change in an upstream flat file without headers?
With these it helps Based on your description, I presume you either know or will find out the informats for the new columns also. If that is the case, why don't you auto generate the code to read the file?Since you have the header information, assumi
TAG : sas
Date : December 23 2020, 07:30 PM , By : snk
Derive unique libref and/or fileref in SAS
Derive unique libref and/or fileref in SAS
will be helpful for those in need The FILENAME() function already provides a method for this. When you call it with a missing value for the fileref it generates one using format LNnnnnn.
TAG : sas
Date : December 23 2020, 04:01 PM , By : Pieter Taelman
Make macro variables name as a value
Make macro variables name as a value
hop of those help? An error has occured cause of incorrect use of quoting macro variable. This article says:
TAG : sas
Date : December 22 2020, 03:30 PM , By : enginecrew
Sharing variables when parallel processing
Sharing variables when parallel processing
it helps some times As you correctly notice, the different SAS programs do not share variables automatically, but you can pass them explicitly:
TAG : sas
Date : December 21 2020, 03:04 PM , By : user186831
Creating specific PROC JSON hierarchy
Creating specific PROC JSON hierarchy
it helps some times Export defaults to outputting a dataset as an array of objects of name:value pairs. With NOKEYS the construct is an array of arrays, with the inner array being an array of values.In order to get a single array of values for a colu
TAG : sas
Date : December 20 2020, 04:36 AM , By : s8k
Is there any better ways to compare cases between different row in SAS?
Is there any better ways to compare cases between different row in SAS?
I wish did fix the issue. During some data cleaning process, there is a need to compare the data between different rows. For example, if the rows have the same countryID and subjectID then keep the largest temperature: , I think you complicate task.
TAG : sas
Date : December 05 2020, 12:06 PM , By : n1ckless_id
Accumulator variables and its use
Accumulator variables and its use
wish help you to fix your issue you have multiple things in your code, which you need to change. missing numeric value is represented as . character data set is referenced using set statement not infile accumulator variable you are talking about is s
TAG : sas
Date : December 01 2020, 04:55 PM , By : John Tate
what is the length of this variable?
what is the length of this variable?
To fix this issue To change the length,we must use the LENGTH statement as the very first statement in the DATA STEP ,but the position will be changed at the same time. In your code the LENGTH statement has no effect on the length of JOBCODE variable
TAG : sas
Date : November 28 2020, 09:01 AM , By : Chris Lomax
SAS pseudo codes execution: if VAR(t+1)>VAR(t) then output VAR(t)
SAS pseudo codes execution: if VAR(t+1)>VAR(t) then output VAR(t)
I hope this helps . To compare a record with the subsequent record, one way is to merge the table on to itself, with the second version starting from record number 2. Therefore record 1 in table1 will join with record 2 in table2 etc. You also need t
TAG : sas
Date : November 27 2020, 09:01 AM , By : Mena
dynamically exclude column names in proc sql macro
dynamically exclude column names in proc sql macro
may help you . Change the macro parameter name to be something better informing, for example
TAG : sas
Date : November 27 2020, 04:01 AM , By : Josh Tegart
Why doesn't SAS/ACCESS work ?
Why doesn't SAS/ACCESS work ?
hope this fix your issue Because you do not have a license for SAS/ACCESS to Teradata. You do have ACCESS for ODBC. Create an ODBC connection to Teradata and use that connection in SAS.
TAG : sas
Date : November 24 2020, 09:00 AM , By : JoeKaras
Using variables in SAS User defined function
Using variables in SAS User defined function
like below fixes the issue The macro processor evaluates before the results are passed onto base SAS for processing. Since your program uses this macro logic.
TAG : sas
Date : November 22 2020, 02:59 PM , By : Sigfrieg
rewrite these code using macro variable
rewrite these code using macro variable
I hope this helps you . You should read the documentation on how symput() works in relation to the macro compiler and the data step compiler. http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htmp09y28i2d1kn8qn1p1icxchz37
TAG : sas
Date : November 22 2020, 10:54 AM , By : user126922
How do I work with a SAS file that was created in a different format (Linux/Windows) if I don't have access to machine t
How do I work with a SAS file that was created in a different format (Linux/Windows) if I don't have access to machine t
Does that help I have numerous SAS datasets on my Windows 7 / SAS 9.4 machine: , You can use the colon operator or dash to shortcut your process:
TAG : sas
Date : November 22 2020, 10:40 AM , By : Paul
Which one of the following represents the new variable that are created?
Which one of the following represents the new variable that are created?
hop of those help? The variables in answer A represent the variables read from the existing dataset work.stuff. As such you would probably not consider them 'new'.The variables in answer C are created by the definition of the array DIFF_SALES. We kno
TAG : sas
Date : November 21 2020, 09:01 AM , By : lietkynes
SAS program, How to do the calculation based on two tables without IML
SAS program, How to do the calculation based on two tables without IML
will be helpful for those in need Maybe I'm missing something but a cross join should also work fine with the GEODIST function and then a transpose to make it wide. It doesn't matter how many points are in each file, though I suppose if it got big en
TAG : sas
Date : November 20 2020, 03:01 PM , By : user183289
How to use lag function to calculate next observation in SAS
How to use lag function to calculate next observation in SAS
This might help you The problem with using lag is when you use lag1(Cal) you're not getting the last value of Cal that was written to the output dataset, you're getting the last value that was passed to the lag1 function. It would probably be easier
TAG : sas
Date : November 19 2020, 12:41 AM , By : PeteFilicetti
"Automatically" calculate linear combination of parameter estimates with PROC GLM
"Automatically" calculate linear combination of parameter estimates with PROC GLM
should help you out You are looking for PROC SCORE. This takes output regression or factor estimates and scores a new data set. See here for an example. http://support.sas.com/documentation/cdl/en/statug/66859/HTML/default/viewer.htmstatug_score_exam
TAG : sas
Date : November 17 2020, 12:00 PM , By : yogan
how many observations will the data set contain?
how many observations will the data set contain?
With these it helps The following is the code:
TAG : sas
Date : November 14 2020, 09:01 AM , By : Goeran
Counting number of different fields in SAS
Counting number of different fields in SAS
will help you Array processing is one (of several) ways to obtain your summary counts.
TAG : sas
Date : November 11 2020, 03:01 PM , By : user152423
Build macro Variables on another macro var
Build macro Variables on another macro var
this one helps. You can use %SYSFUNC() to call functions in macro code. You can use the optional format specification to control how the results is converted to the text that is stored in the macro variable.So if you start with macro variable in DATE
TAG : sas
Date : November 09 2020, 08:00 AM , By : JSebok
How do I convert from date to character string in a sas macro
How do I convert from date to character string in a sas macro
help you fix your problem A put command in SAS always returns a character string. The distinction between %sysfunc(putc()) and %sysfunc(putn()) is what type of format the second argument of the function is - putc understands character formats and put
TAG : sas
Date : November 06 2020, 03:01 PM , By : Timbo
Data incorrectly read in as missing when using DSD option in infile statement (SAS)
Data incorrectly read in as missing when using DSD option in infile statement (SAS)
it fixes the issue dsd does not say "use a delimiter". It tells SAS how to use that delimiter (mostly, saying anything in quotes is treated as one field, and modifying how consecutive delimiters are treated). dlm=',' is necessary to read this in corr
TAG : sas
Date : November 03 2020, 03:01 PM , By : dnyaneshwar
In SAS how to transpose a table producing a dummy variable for each unique value in a column
In SAS how to transpose a table producing a dummy variable for each unique value in a column
may help you . Seems like you need the help of PROC TRANSREG to generate a design matrix that is reduced.
TAG : sas
Date : November 03 2020, 04:01 AM , By : Per
How to reference control characters (eg CRLF) in SAS Macro Variable
How to reference control characters (eg CRLF) in SAS Macro Variable
With these it helps The function is to blame, once the strings mactest or lf are fed into find the 0 carriage return or line feed or similar are just converted to spaces \x20 which is why you are seeing these results. Best solution I can think of is
TAG : sas
Date : November 01 2020, 04:01 AM , By : Matthew Steed
How many observations in the output dataset?
How many observations in the output dataset?
To fix the issue you can do Why would you expect the output dataset to have only 3 observations. There is an implied OUTPUT statement at the bottom of the DATA step. If you want to output only those records where STYLE IN ("CONDO","RANCH") you could
TAG : sas
Date : October 31 2020, 01:52 PM , By : Star Gryphon
Using macro variables in SAS statements copied from %include
Using macro variables in SAS statements copied from %include
To fix the issue you can do Yes. If you set the macro variables prior to the %include statements, the macros called using %include will first look locally to resolve the macro variables and then look globally, which is where they will reside. There a
TAG : sas
Date : October 31 2020, 01:47 PM , By : Naveen
SAS Univariate put all tests into 1 table
SAS Univariate put all tests into 1 table
will help you You were close. Use ods output GoodnessOfFit; instead. Take a look at this example using sashelp.cars. This produces a single table with all goodness of fit estimates.
TAG : sas
Date : October 31 2020, 05:01 AM , By : kuba53280
which value would SAS assign to the variable?
which value would SAS assign to the variable?
Any of those help Using of Rev: in the mean() function says that it should take the mean of all variables that start with "Rev", so since the values of the variables that start with "Rev" are 1.2, 1.6, and 2.0, the value of total will be 1.6.
TAG : sas
Date : October 30 2020, 10:01 AM , By : enginecrew
Importing data to SAS from text file with multiple delimiters and line breaks in character variables
Importing data to SAS from text file with multiple delimiters and line breaks in character variables
I hope this helps . SAS can read delimited files that have embedded line breaks as long as the embedded line breaks use different character than the normal end of line. So if your real observations end with CRLF (normal for a Windows text file) and t
TAG : sas
Date : October 30 2020, 05:01 AM , By : Gilmar Souza Jr.
SAS ODS Documentation Syntax Error
SAS ODS Documentation Syntax Error
I hope this helps . It seem that path option is valid in ods html, but is not valid in ods pdf, but it doesn't matter because you can specify absolute path in file option.
TAG : sas
Date : October 27 2020, 04:13 PM , By : user158193
SAS: Creating classes by enumeration
SAS: Creating classes by enumeration
around this issue You will be using two primary tools: The mod function and a sum statement. The sum statement looks like incorrect syntax, but it's a special case of retain._N_ is a special variable that acts as your observation counter. Every time
TAG : sas
Date : October 23 2020, 03:08 PM , By : Grace Jones
Add a number of days to SAS datetime format
Add a number of days to SAS datetime format
seems to work fine Here a code sample that will print your desired result. Like the other answer states, DTDAY will tell SAS to add days when the base value is a datetime instead of a date.
TAG : sas
Date : October 23 2020, 01:08 AM , By : user158193
tranwrd doesn't replace correctly and truncate target string
tranwrd doesn't replace correctly and truncate target string
wish of those help There's no need to do all the transformations in your code. You can use the relevant language date informat to read the data directly. In your case it is in Spanish, so the espdfde9. informat will read the source data as a date (us
TAG : sas
Date : October 22 2020, 03:08 PM , By : Brian
SAS can't read following space delimited file
SAS can't read following space delimited file
Does that help Your file does not conform to the rules for LIST input with imbedded blanks. You can still read it without changing the file but you have to find the column where the name field ends.
TAG : sas
Date : October 14 2020, 09:39 AM , By : todor
How to remove special ASCII characters?
How to remove special ASCII characters?
fixed the issue. Will look into that further You can use kpropdata function. From doc:
TAG : sas
Date : October 09 2020, 02:00 AM , By : omaidog
Need same output in sas
Need same output in sas
Hope that helps So I have the following data: , Try this:
TAG : sas
Date : October 08 2020, 06:00 PM , By : 66.
Remove invalid string entries (\n) from numeric column variables
Remove invalid string entries (\n) from numeric column variables
it helps some times The import process that finds data that is non-numeric will cause that column to be _character_, so some of your A1-A54 are character.What happens if you code this ?
TAG : sas
Date : October 08 2020, 01:00 PM , By : glisignoli

shadow
Privacy Policy - Terms - Contact Us © scrbit.com