Hi, tsmk is my time-dependent covariate, deathstatus_inhance is censor, and stime_inhance is time. The "Change step" worked well, but the "Count step" only worked for four observations and stopped. Please help me to correct my code. DATA analysis.change;
SET analysis.smk_stime2;
ARRAY tsmk_(*) tsmk_1-tsmk_5; *call in the time-varying smoking variables;
ARRAY chng(5); *the new indicator variables;
t=1; *initialize the position variable for the indicator variables;
DO i = 2 TO 5;
IF tsmk_(i) NE tsmk_(i-1) THEN DO; *detects whether there is a change in smoking status;
chng(t) = i-1; *assigns the last year the status remained constant;
t=t+1;
END;
END;
RUN;
DATA analysis.count;
SET analysis.change;
ARRAY tsmk_(*) tsmk_1-tsmk_5; /* call in the time-varying smoking variables */
ARRAY chng(*) chng1-chng5; /* call in the indicator variables */
start = 0; /* initialize the beginning time for the study */
censor2 = 0; /* initialize the new censor variable */
t = 1; /* initialize the position variable for the indicator variables (chng1-chng5) */
DO i=1 TO stime_inhance; /* makes sure we only output the records that smoking status remains constant */
IF (chng(t) > . and chng(t) < stime_inhance) or i = stime_inhance THEN do;
/* assign the value of smoking status */
IF chng(t) > . THEN smoking_status = tsmk_(chng(t));
ELSE smoking_status = tsmk_(stime_inhance); /* assign the end time */
stop = min(chng(t), stime_inhance); /* assign the value of the censor variable */
IF i = stime_inhance THEN censor2 = deathstatus_inhance; /* assign the new start time */
IF t > 1 THEN start = chng(t-1); /* move the position variable */
t = t + 1;
OUTPUT; /* output the record to the new dataset */
end;
END;
RUN;
... View more
Hello,
I am struggling with controlling page breaks in proc report/ods PDF. I already did a post a few months ago (https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-suppress-table-splitting-in-ODS-PDF/m-p/907292#M26446), but I have not found a solution yet. First, I thought I will just use ods rtf with the keepn option, but that brings more problems than it solves. Now, I have just found a paper that kind of describes the problem from Stetz et al. "Controlling Page Breaks when using Proc Report" (https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://support.sas.com/resources/papers/proceedings-archive/SUGI95/Sugi-95-70%2520Stetz.pdf&ved=2ahUKEwjHib_10PuFAxUi_rsIHa0GA9oQFnoECBAQAw&usg=AOvVaw0Z1J0znhm8-SeB_Oxq4tBr). Unfortunately, the paper is quite short and I do not understand how the data in the example code is structured. My question is: Does anyone have further knowledge on using "line counting" to control page breaks with proc report? Or does anyone know other papers that talk about this issue?
@Cynthia_sas did you write the paper? And if so, have you got any tips for the page break control?
If anyone needs code examples I can provide code and data, but for now I thought it would be more useful if I try different approaches before just posting my code where I did not achieve much yet. I am grateful for any help.
Kind regards
... View more
Hi everyone, I'm reaching out to the SAS community today seeking some guidance. Our team is currently in the process of transitioning from base SAS to SAS Studio and migrating our data storage from a local file server to Amazon S3.
We've successfully uploaded all our historical datasets (in .sas7bdat format) from the local server to S3. However, we're encountering an issue when trying to load/read this data directly from S3 into CAS using SAS Studio.
While I can perform various S3 bucket management tasks like creating, deleting, uploading data from CAS, and copying data between buckets, I'm unable to utilize PROC S3 to directly load data from S3 into CAS using .sas7bdat files.
proc s3 keyid= &accesskey secret=&scaccesskey region=®i;
get "/viya-data/AAI/Pertape/datasets/pt31mar24.sas7bdat" "/nfsshare/data/sasdata/S3Transit/pt31mar24";
run;
While using PROC S3 if a file size smaller than 2MB then i am getting different error than above one ". I cross checked with my sas admin that we have read and write permissions.
Here's the interesting part: I can successfully use PROC CASUTIL's LOAD function to read data from S3 in formats like .sashdat, CSV, or Excel. It's specifically the .sas7bdat format that seems to be causing the issue.
caslib amz dataSource=(srcType="s3" accesskeyid=&accesskey secretaccesskey=&scaccesskey region=®i
bucket="viya-data" objectpath="/AAI/Pertape/datasets/");
proc casutil incaslib=amz outcaslib="S3Transit";
load casdata="pt31mar24.sas7bdat" casout="tl_website_30apr24";
quit;
Error message while using PROC CASUTIL :
I'm wondering if anyone in the community has faced similar challenges when working with .sas7bdat files in S3 and CAS. If so, any insights or solutions you could share would be greatly appreciated. We are currently using SAS Viya LTS 2023.03
Thank you in advance for your time and assistance! -Bhaskar
... View more
I would like to delete the folder folderToDelete, which contains subfolders and those folders might contain subfolders, and so on. I do not have permission to do the x command. I have the following code (after looking at the following post Delete folder (directory) and all files in it๐ %macro delete_folder(folderToDelete);
data work.FilesToDelete;
length Name $ 100;
keep Name;
rc = filename("folder", "&folderToDelete.");
dirId = dopen("folder");
do i = 1 to dnum(dirID);
Name = dread(dirId, i);
output;
end;
rc = dclose(dirId);
run;
data _null_;
set work.FilesToDelete end=lastDeleted;
put "Deleting " Name;
rc = filename("delfile", cats("&folderToDelete./", Name));
rc = fdelete("delfile");
put "del file " rc=;
rc = filename("delfile");
if lastDeleted then do;
put "Deleting the folder '&folderToDelete.'";
rc = filename("folder", "&folderToDelete.");
rc = fdelete("folder");
put "del folder " rc=;
rc = filename("folder");
end;
run;
%mend; However, since my folder contains subfolders, only the tables are delete and not the subfolders, resulting in the main folder not being deleted. In that sense, what I would like was to apply a function recursively to delete every file inside any subfolder (or any other suggestion you might have). As an example, if my folder has the following structure: > folder > subfolder_1 > T_1_1.sas7bdat > T_1_2.sas7bdat > T_1_3.sas7bdat > subsubfolder_1 > T_1_1_1.sas7bdat > subfolder_2 > T_2_1.sas7bdat > T_1.sas7bdat > T_2.sas7bdat > T_3.sas7bdat > T_4.sas7bdat after running the first data step, which reads the folder, I get Name subfolder_1 subfolder_2 T_1.sas7bdat T_2.sas7bdat T_3.sas7bdat T_4.sas7bdat and then in the second data step, only the tables are deleted. However, I would like to delete the entirety of the folder. Can someone help?
... View more
Due to an unusual specification, I need to make a connection between SAS VIYA4 and MS Power BI. I have found solutions to create this type of connection between SAS 9.4 Unfortunately, on the forum and on the Internet I do not see any valuable materials on this type of connection from the VIYA system. An additional complication is that the connection must be made by downloading data from IN-Memory tables, but if this is impossible I would like to get any connection. In summary, the in-memory tables sas VIYA4 is the source of the data and Power BI analyzes it. I was wondering if it is possible to use SAS OLPA SERVER for this, to integrate the data contained in SAS VIYA with MS Power BI. Moreover, OLAP SERVER is a desktop tool. I do not hide the fact that ideally there would be an alternative tool running in an on premise solution on the browser side. I am aware of the differences between VIYA and SAS 9.4, and how this idea sounds. The question is do you have any ideas on how to get around any associated inconvenience?
... View more