Keep track of who accessed SAS data sets in a compute server
Recent Library Articles
Recently in the SAS Community Library: SAS' @BrunoMueller gets asked whether it is possible to track who has accessed which SAS data sets and when. He usually refers them to this article: Auditing data access: who did what and when? This post expands on that article and explains how to use this in SAS Viya with additional features such as custom message layout and filtering (no log entries for libref WORK or SASHELP).
I import a excel file with proc import into a SAS table and than put that data into a teradata table.
I get a error when I load the data into the teradata table. Bad character.
We checked the excel file and in certain rows we saw hidden non printable characters (ZWSP en NBSP).
We are trying to filter those characters out with the following code.
DATA work.filtered;
SET work.unfiltered;
name_new = PRXCHANGE('s/\x{200B}//',-1, name); /* does not work to filter out ZWSP */
name_new = PRZCHANGE('s/\&zwsp;//',-1, name); /* does not work to filter out ZWSP */
RUN;
What am I doing wrong or is there a other solution within SAS.
... View more
Hi All, SAS version: SAS Viya LTS 2023.9 I am trying to make an API call to upload a file and create a table. I am using this link as a reference: https://developer.sas.com/rest-apis/dataTables/createTableFromMultipart. I am doing this through Postman for testing purposes, here is code in Python: import requests
url = "https://*****.com.au/dataTables/dataSources/Compute~fs~be7240bc-96e9-4eff-b3f9-ba9e23d7d3b2~fs~WORK/tables"
payload = {'tableRequest': '{
"sourceArguments": {
"delimiter": ",",
"firstRowHasColumnNames": true
},
"targetArguments": {
"tableName": "IMPORT_TEST_NONADMITTED_TEST",
"replace": true,
"columnDefinitions": [
{ "name": "RecordID", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "T2Clinicv7", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "fundingsource", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "STATE", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "indstat", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "bir_date", "type": "date", "informat": "DDMMYY8.", "format": "DDMMYY8." },
{ "name": "service_date", "type": "date", "informat": "DDMMYY8.", "format": "DDMMYY8." },
{ "name": "Postcode", "type": "character", "length": 6 },
{ "name": "SA2", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "pat_multiprov_flag", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "est_eligible_paed_flag", "type": "numeric", "informat": "BEST32.", "format": "BEST12." },
{ "name": "estabid", "type": "character", "length": 9 }
]
}
}'}
files=[
('file',('test_data_non_admitted.csv',open('/C:/****/test_data_non_admitted.csv','rb'),'text/csv'))
]
headers = {
'Content-Item-Type': 'application/vnd.sas.data.table.cas.delimited.request+json',
'Content-Type': 'multipart/form-data',
'Authorization': '***********',
'Cookie': '***********'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text) Thi is the response I am receiving: {
"httpStatusCode": 503,
"errorCode": 11916,
"message": "The provider for the source \"Compute~fs~be7240bc-96e9-4eff-b3f9-ba9e23d7d3b2~fs~WORK\" is not available, or it is currently starting up.",
"details": [
"path: /dataTables/dataSources/Compute~fs~be7240bc-96e9-4eff-b3f9-ba9e23d7d3b2~fs~WORK/tables",
"correlator: 65510512-b779-484e-8c1a-eef71fa7bac9"
]
} Any ideas of how to make this work will be appreciated. Thanks! Pablo
... View more
When I output PNG, the legend text can be fully displayed, but when I output vector graphics, the last letter may be obscured, and using the OUTERPAD options does not work
... View more
I have searched around, but no luck finding an answer (perhaps I am using the wrong terms). I have arrays set up to reference full lists of variables, but they are becoming quite bulky. Is it possible to reference only a few characters in the middle of a variable name? In stata it would look like this: for each x in cath fall { use `datafile', clear collapse (mean) measure_`x'_value /// pred_measure_`x'_value [aweight = measure_`x'_count], by (state) I am not worried about the collapse or aweight portions, but I am trying to find out if it is possible to replicate that reference to `x' and cycle through just the middle of the variable name. In stata, the `x' would be replaced to measure_cath_value and measure_fall_value etc. Thanks for any help!
... View more
Hello eveyone! I use SAS Enterprise Guide 8.5 with and have been struggling with the following issue for a few days. I run the code below: DATA AAA;
SET SASHELP.CARS;
PAGE_NO = FLOOR((_n_-1)/15)+1;
RUN;
ODS RTF(ID=INDA) FILE= "\\app01.icrc.local\Share\Projects\ROX_795_SC-332A\Biostatistics\Prog\A.rtf" CONTENTS=YES STARTPAGE=YES TOC_DATA;
PROC REPORT DATA=AAA(obs=100);
COLUMNS PAGE_NO Make Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway;
DEFINE PAGE_NO / ORDER NOPRINT contents="";
DEFINE Make / ORDER NOPRINT;
DEFINE Model / DISPLAY ID STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE Type / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE Origin / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE DriveTrain / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE MSRP / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE Invoice / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN} contents="" PAGE;
DEFINE EngineSize / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE Cylinders / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE Horsepower / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE MPG_City / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
DEFINE MPG_Highway /DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
COMPUTE BEFORE Make;
LINE @1 " ";
LINE @1 Make $16.;
LINE @1 " ";
ENDCOMP;
break before page_no / page contents="";
compute after _page_;
line "Some text";
line "Some other text";
endcomp;
compute after;
line "End of Table";
endcomp;
RUN;
ODS RTF(ID=INDA) CLOSE; My purpose is to produce a report: 1) With page breaks (hence the line break before page_no / page); 2) With footnotes in every page and a messege in the end of table; 3) With page breakes before the column Invoice (hence DEFINE Invoice / ... PAGE); 4) With a line before every new group (hence the COMPUTE BEFORE Make block); The problem is that the generated report has the first page empty: Everything else works fine. I tried some approaches. So, replacing break before page_no / page with break after page_no / page solves this problem, but creates other ones (for example empty pages in the end). Also, deleting the COMPUTE BEFORE Make block make thing better. But unfortunately, the line before every group is required. Of course reducing column width (so that all columns fit in one page) helps too, but in real projects we often have reports with many columns. I hope someone could help me with good advice. Thanks in advance!
... View more
Nominations are in, and the SAS Customer Recognition Awards voting is complete! Winners get a full trip to SAS Innovate (May 6-9) in Orlando, FL! See the 60+ inspiring entries from SAS users! Winners will be announced at SAS Innovate!