16,121 questions
1
vote
3
answers
41
views
SAS Proc transpose wide to long multiple variables
I had some data with a long text string that contained data with certain dates within them. I parsed out each individual text section and the corresponding date into different columns. Each ID will ...
0
votes
1
answer
35
views
The variable level keeps reading invalid in the adjusted model but not the unadjusted model
everyone I am new here and I need some help. I keep encountering this error:
proc surveylogistic data=nhis29;
cluster ppsu;
strata pstrat;
weight wtfa;
class SRVY_YR(ref='2021') edu(ref='1') pov(...
1
vote
0
answers
17
views
COX regression model has a wide 95%CI, ph was not satisfied
enter image description hereI did a cox regression model. The data was classfied according to a variable. The three group was 7,143,7 according the ECOG score. The 95%CI was wide. In this dataset, is ...
1
vote
1
answer
40
views
Flag observations with same ID/Date but different result
I am trying to flag observations with the same ID and Date but different results. Not all observations with the same ID and Date will have a different result but a large fraction do. I have already ...
0
votes
0
answers
31
views
SASPy: How dtype parameter within sd2df_DISK() function works
I have started working with an EL proccess that transfers data from SAS to Azure using SASPy.
Regarding one specific table, I have found out that the transference of some string fields is forced via ...
0
votes
0
answers
34
views
Create query on SAP 4/Hana view with SAS e.g
I try to create a query on SAS view, based on a SAP 4/Hana table.
I get the following error:
ERROR: Unable to transcode data to/from UCS-2 encoding.
How can I change the encoding?
I've tried to copy ...
1
vote
1
answer
46
views
Order of the relative operator in SAS?
I run the following SAS program, and I get the result=0, it suprising me!
data calculation;
result = (3 gt 2 = 1); /* 0 */
run;
proc print;
run;
I get totally confused about it, could someone ...
0
votes
1
answer
31
views
How to Display Row Percentages (Prevalence) Instead of Column Percentages in table1 Package in R?
I am using the table1 package in R to generate descriptive statistics stratified by a variable (e.g., HIV status). By default, the package provides column percentages, showing the proportion of each ...
0
votes
0
answers
20
views
How to Adjust Key Value Size and Font Size for Alignment in SAS Visual Analytics 2024.07
I am working with SAS Visual Analytics version 2024.07 and need assistance in adjusting the key value size for proper alignment. Additionally, I would like to customize the font size to better suit my ...
0
votes
1
answer
28
views
SAS FSEDIT screen YES/NO
Want to limit responses on SAS FSEDIT screen control to yes/no.
Not converting ANYTHING via code.
There are two responses:
"YES"
"NO".
NOT 1 or 0 or anything else.
How do I limit ...
1
vote
2
answers
38
views
Assigning Excel Labels to a SAS dataset
I have a SAS dataset with around 250 variables, and I want to assign labels from a two-column ("Variable" and "Label") excel file to each variable. Obviously, entering in each ...
0
votes
1
answer
29
views
Retain only the first value of a variable
suppose to have the following:
data DB;
input ID :$20. Admission :date09. Discharge :date09. Index;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2015 20JAN2015 1
0001 21FEB2015 ...
0
votes
1
answer
41
views
Accessing .sas7bcat file?
I've got a .sas7bcat file (with no corresponding .sas7bdat file). How do I open this in SAS?
Part of the issue is that, according to the error message, it was created for a different operating system.
...
2
votes
2
answers
65
views
How is the SAS proc sql create table (where=()) option different to a where clause in the sql query and when should it be used?
From what I can tell both example code blocks will produce the same output, but the in the first statement the where is applied after the query inside is completed whereas in the second statement the ...
0
votes
2
answers
14
views
Detect word in character variable text string and create variable based upon presence of that word SAS
Hello and sorry for the long title name! I am working with some data that has a long text string (some observations have up to ~2000 characters). Within these strings could be a word (AB/CD) that ...
0
votes
1
answer
57
views
Get all parents and children for each record, including child-level and chain from main parent to child
I have a table with parent-child relationship. For a dashboard I am creating, I need to create a table so the dashboard (SAS Viya) can work with the table. For that I need to get for every company id (...
0
votes
1
answer
35
views
How to write Do loop in SAS to use the proc power?
I am trying to produce the sample size for various value of power?
I can do it for one specific value of power (say 0.90). I plan to write do loop over different power values (0.8 to 0.95 increased by ...
1
vote
1
answer
59
views
SAS connecting to another server is randomly blocked with an error. Can I tell SAS to repeat until successful?
I use SAS to connect to a remote SQL database that is experiencing some issues. It randomly blocks the connection attempt. Right now our only recourse is to hang around resubmitting the program until ...
0
votes
0
answers
30
views
How to Compare Levels of One Factor Within Each Level of Another Factor in SAS glimmix?
I’m working with the following PROC GLIMMIX code in SAS:
proc glimmix data=my_data;
class x1 x2 x3;
model y = x1|x2;
random x2;
random x3;
lsmeans x1*x2 / pdiff lines slicediff=(x2);
...
-2
votes
1
answer
33
views
Adding Comparison Annotations to Boxplots [closed]
Boxplot with Tukey Comparison Bars
I had run an ANOVA test and found that at least one of the means among my groups were statistically significantly different. As follow-up analysis, I ran a Tukey ...
0
votes
3
answers
64
views
R newbie: R equivalent to SAS proc sql, group by, having, count, remerging summary statistics
In SAS i write a code that in the log looks like:
2 proc sql;
3 create table test as
4 select
5 ID,
6 GENDER,
7 BIRTHYEAR
8 from
9 libname.dataset
10 group by ID
11 having ...
0
votes
2
answers
70
views
SAS calling external process with network path
On SAS Windows, I have a SAS script calling an external .bat file. I use the following:
%SYSEXEC("\\mymachine\order\mypath\running.bat");
which does not recognise the path and default to a C:...
0
votes
0
answers
40
views
count continuous enrollment in claims data
I need to count number of patients with continuous enrollment after indexdt by month in claims data in SAS.
Below is my data structure.
startdt is the starting date of insurance coverage and
enddt is ...
0
votes
1
answer
46
views
Flag duplicate observations in SAS
I am working with a dataset that has ID, Event ID, Event date time, and event reason. My problem is that sometimes there is a unique event ID but the exact same event date time, ID, and event reason. ...
3
votes
2
answers
70
views
Why hash find method behaves differently with length statement and "if 0 then set" statement
I have following exemplary piece of code:
data hh;
keyx=1; xx=21;output;
keyx=3; xx=23;output;
keyx=4; xx=24;output;
keyx=5; xx=25;output;
run;
data tbl;
keyx=1;output;
keyx=2;output;
keyx=4;output;
...
1
vote
1
answer
54
views
How to read and identify deleted observations in a SAS7BDAT file in python
in SAS, when observations are “deleted,” they aren’t completely removed from the dataset but are instead marked for deletion. When reading such sas7bdat files into Python using libraries like pandas, ...
0
votes
1
answer
34
views
How to transpose in SAS EG when there are multiple columns of differing data types (numeric, alphanumeric, & character)?
I have a dataset that is approximately 30,000 rows & approximately 30 columns, consisting of:
1 column is a unique identifier (SSN)
6 columns are of diagnostic ICD codes
6 columns are of ...
0
votes
1
answer
32
views
Update an Index variable based of the values it takes
suppose to have the following dataset
data DB;
input ID :$20. morbidity;
cards;
0001 1
0001 1
0001 0
0001 2
0002 2
0002 0
0002 2;
run;
Is there a way to get the following?
data ...
0
votes
3
answers
70
views
Find the first row where the column header contains specific keywords
I have multiple Excel files saved in a folder, each containing only one sheet with randomly named sheet tabs. I need to find the first row that contains the column header "Job No." and ...
0
votes
1
answer
53
views
SAS Rename External Files
I'm trying to rename some files saved in a specific folder. I also included some conditions when renaming them, like when the file name contains '214' then rename it to A; when the file name contains '...
0
votes
1
answer
48
views
How can I format header and footer using ODS Word in SAS?
I would like using ODS Word in SAS to set the header with companyname on the left and sectionname on the right as in the image.
proc template;
define style styles.mystyle;
parent = styles.word;
...
0
votes
0
answers
51
views
Set a lag time for a job to start running once dependency jobs have finished
In Autosys, I would like to set up a lag time for a job to run once all dependency jobs have finished, for example, JobFinal is dependent of jobs Job1, Job2, ... Job10, once all these jobs (Job1-10) ...
0
votes
0
answers
31
views
SAS Kaplan Meier how do I get the results to show together?
I am looking at a copy number of various genes to survival time. I want to see the genes individually and if two or more genes together are different. The picture of the dataset is attached.
The ...
0
votes
1
answer
49
views
Convert yyyymm into sas date9 and split
I have dates like "202407". How can I convert them into Sas date9. format to have "JUL2024"? Is there also a way to separate into two new variables the month "7" and the ...
0
votes
0
answers
25
views
ewma from SAS to Python with reset
I'm trying to translate the SAS code for an EWMA control chart into Python. It is a control chart with predefined UCL and LCL, based on historically determined values.
In SAS, I introduced the RESET ...
1
vote
1
answer
41
views
Combine multiple observations into one SAS
I have a dataset of rates by age, state, and year. Each state and year has multiple observations with only one rate per observation. I need help combining the observations so all the rates per state/...
0
votes
0
answers
28
views
ARIMA time series: different results between SAS and Python
I am trying to translate a time series analysis program from SAS to Python.
In SAS, I am using a proc arima as shown below:
%let dummy_regr = gen_1 gen_2 feb marz apr mag giu ago set ott nov dic_1 ...
1
vote
2
answers
39
views
SAS read table with special character in name passed through macro parameter
I don't know how to achieve to read table which has a special character # in the name and is being passed in as a macro parameter.
Here is a simple example:
%macro my_macro(p_lib=,p_table=);
proc ...
1
vote
2
answers
57
views
How to create a column with quantiles ranked groups in SAS using weight?
I have a dataset which has the following relavant variables, along with many others:
data have;
input group $ score weight;
datalines;
A 12 1.2
A 19 1
A 23 1.7
A 40 2
A 11 1
A 16 1.5
A 34 1.3
A ...
0
votes
1
answer
60
views
SAS EG: Scheduled job CLIENTUSERID not resolved
I'd like to be able to assign a "default" CLIENTUSERID when the SAS scheduler runs. I've tried to use coalesce but it doesn't work:
%LET USER_ID=%SYSFUNC(COALESCEC(&_CLIENTUSERID,'123456'...
1
vote
1
answer
77
views
pandas.read_sas() fails when bad timestamps exist
I have a file with some bad timestamps and the read_sas method in pandas fails. There seems to be no recourse. The file is read fine in R with haven package, and the bad timestamps are identifiable.
...
2
votes
1
answer
41
views
How to trace a SAS FCMP Compilation Error?
I get the below after compiling around 70 or 80 inter-connected FCMP functions. The weird thing is, it doesn't happen at one particular function - it only happens when exiting (quitting) the FCMP ...
0
votes
1
answer
57
views
Creating a Vertical Calendar
Using SAS, is is it possible to use existing date functions and macros to vertically stretch out a calendar data frame?
For example, I want to make a data frame with columns: day, month, year.
This ...
0
votes
1
answer
53
views
Updating a SAS table dynamically as new records come in
I'm not very familiar with hashes in SAS and need help updating a table dynamically as new rows come in.
Lets say there is a crosswalk table
Crosswalk
ID
Family
AAA
AAA
BBB
AAA
CCC
AAA
ZZZ
XYY
...
0
votes
2
answers
72
views
SAS convert variable formats to a value
I have a SAS dataset which has formats applied to columns. So basically the value of the column is numeric and when I query the table it shows the value from the format. The problem I have is I have ...
0
votes
1
answer
27
views
SAS Capturing a regression output and use it as a variable
I am running a regression on var_x versus var_y in a calibration step. In a later step I want to use the outcome of this regression as a variable in my code.
For now I am running the regression and ...
0
votes
1
answer
38
views
Trying to calculate time between subsequent appointments in SAS
I am working with a dataset that has multiple visit dates per ID. I am trying to calculate the time between each subsequent appointment (visit 1 vs visit 2, visit 2 vs visit 3, etc.).
My data ...
-2
votes
1
answer
52
views
SAS cannot read file cannot read properly the data
The imported data is full value,but in coding there,it will eat one character.Example that my data is RM800-RM1201,but the output just only RM800-RM120.The Data file format is xlsx
DATA WANT;
SET ...
0
votes
0
answers
81
views
Can we read k8 container logs using a sidecar container and without using kubectl?
Background: We are using third-party software (SASViya) that has multiple deployments, cronjob, stateful sets, and finally the pod templates which is responsible for creating new pods whenever a user ...
0
votes
2
answers
73
views
Sas equivalent function to SQL Server group by cube
I have recently discovered the cool SQL Server group by cube function that summarize the result without a lot of coding. Does SAS have the same without appending a lot of proc summaries. Sample code:...