How to convert a character value to numeric in SAS
Recent Library Articles
Popular in the SAS Community Library: Follow along as SAS' Anna Yarbrough demistifies how Base SAS supports two variable types: character and numeric. You'll learn how to convert a char to a numeric or a date value.
Hi all I am working with a client and they have their SAS Studio linked to a UNIX server. SAS Studio is version 3.8 and seems to be a standalone installation, no SAS EG or other products. I want to be able to solicit information from a user, I understand that SAS Studio does not have prompts, I did try the custom prompt tasks but they are totally useless at least in this version of Studio. So I was wondering is it possible to call/execute a .sh script whic would open and ask the users in a command window for the required values and pass these either back to SAS Studio or at least to a txt file inside Studio somewhere. There has to be a way to solict info from users who are not technically and only know how to hit run. Thanks in advance
... View more
Hi,
I have this code:
DATA SALE;
LENGTH FILE $3 DEPARTMENT $10 ;
INPUT FILE DATE:YYMMDD10. DEPARTMENT $;
FORMAT DATE YYMMDD10.;
DATALINES;
102 2024-01-15 RECEPTION
102 2024-01-30 RECEPTION
102 2024-02-10 SHOES
102 2024-02-29 RECEPTION
102 2024-02-29 SHOES
103 2024-01-22 RECEPTION
103 2024-02-15 RECEPTION
103 2024-02-20 RECEPTION
103 2024-03-02 PANTS
104 2024-04-12 RECEPTION
104 2024-05-02 RECEPTION
104 2024-05-20 RECEPTION
104 2024-05-30 SHIRTS
104 2024-06-14 SHIRTS
104 2024-06-30 SHIRTS
;
RUN;
I would like to find, for each file, the first department where the item was transferred after Reception. For that example, the result would be as follows:
Does anyone know how to proceed ?
Thanks
... View more
Hello! I'd like to write the contents of a table to an email, any ideas how to go about this? Here's what I have so far. In the section that reads "PUT RESULTS HERE" I'd like to write: Member: 12345678901 Amount: 10 Member: 1234567892 Amount: 6 Member: 1234567893 Amount: 5 etc. DATA WANT;
INPUT MEMBER : $20. AMOUNT : 8. ;
CARDS;
1234567891 10
1234567892 6
1234567893 5
1122334455 4
;
run; filename outmail email
to=&toEmail.
from=&fromEmail.
subject="Results are in";
data _null_;
file outmail;
put Here are the results: ;
/* PUT RESULTS HERE */
run; Thanks in advance!
... View more
I am having trouble connecting sas_kernel in jupyter to SAS viya. I am currently on a free trial , I found the below spec which needs to be changed in order ti connect with SAS viya. httpsviya = {'url' : 'https://viya.deployment.com', 'context' : 'SAS Studio compute context', 'authkey' : 'viya_user-pw', 'options' : ["fullstimer", "memsize=1G"] } But I am not sure on where to find and what to fill in them. Any help?
... View more
Good Morning,
I have test this macro function that should give the file zise but it is not working.
Please note that we have spde files partitions like
/.../auto/be_auto_prmsep2024.dpf.00010a84.0.2.spds9 /.../auto/be_auto_prmsep2024.dpf.00010a84.1.2.spds9 /.../auto/be_auto_prmsep2024.dpf.00010a84.2.2.spds9
But I would like to get the file size of be_auto_prmsep2024 not of each partition.
I have tried the following SAS function and it is not working
%macro FileAttribs(filename);
%local rc fid fidc Bytes CreateDT ModifyDT;
%let rc=%sysfunc(filename(onefile,&filename));
%let fid=%sysfunc(fopen(&onefile));
%if &fid ne 0 %then %do;
%let Bytes=%sysfunc(finfo(&fid,File Size (bytes)));
%let CreateDT=%sysfunc(finfo(&fid,Create Time));
%let ModifyDT=%sysfunc(finfo(&fid,Last Modified));
%let fidc=%sysfunc(fclose(&fid));
%let rc=%sysfunc(filename(onefile));
%put NOTE: File size of &filename is &bytes bytes;
%put NOTE- Created &createdt;
%put NOTE- Last modified &modifydt;
%end;
%else %put &filename could not be open.;
%mend FileAttribs;
%FileAttribs(c:\aaa.txt)
I would like to create a table like below
path filename size
path1 be_auto_prmsep2024 555 kbytes
path1 be_auto_prmoct2024 545 kbytes
and so on.
how do we do that ?
... View more