I am trying to select numeric data that is greater than 5 bytes. I have entered the below but get an error of ERROR: Function LENGTH requires a character expression as argument 1. Not sure what I am …
Tag: sas
Evaluating a variable using the IN() Function
I’m trying to resolve a datastep variable in the in() function. I have a dataset that looks like the following: |Run|Sample Level|Samples Tested| | 1 | 1 | 1-5 | | 1 | 2 | …
Writing SAS dates to SQL Server databse
How to write SAS dates to Microsoft SQL Server 2016 Date data type in database? I got SAS data with a sas date DataEndDay and I want to write that into a database. The following bit is in use (buffer is just to speed up the testing-failing) : Of course because SAS dates are numbers, direct writing is going to
SAS pass through query to SQL Server
I have some troubles with passing through query to SQL Server. OS is RedHat 6. In SAS Enterprise Guide I try to execute this code: but I faced with error: ERROR: CLI execute error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]INSERT failed because the following SET options have incorrect settings: ‘QUOTED_IDENTIFIER’. Verify that SET options are correct for use
How to add a sum column with respect to a group by
I have a table1 : And i want to add a column wich sum the count column by grouping the first two variables : this is what i do : then : But i have a feeling this is a sloppy way to do it. Do you know any better ways ? For example with no intermediates tables. edit :
Extrapolate running total from .LAST value of a BY GROUP
I trying to figure out how to create a running total, if all we have is the total sum in the .LAST variable. I created a sample dataset that should make it a little clearer what I am after: ; so, as you can see we only have data for the last time the store was in business, which includes
SAS datastep/SQL select latest record from multiple records with same ID
For example I have a dataset as below: By datastep or sql, how could I get the record with id = 1 and latest Date 2002/01/01? Help is appreciated and thanks in advance. Answer Try this sql.
Using macros in SAS SQL
I am wondering of I can consolidate some code into one PROC SQL statement instead of several back-to-back SQL statements. I am using macro to calculate the age of a participant at date of consent for a study, similar to what is provided here and here. I tried to troubleshoot the functionality of macros, and I calculated the total weight