Hallo,
How do I create a calculated column in SAS Data Studio - Data prep
Can somebody give me the right syntax?
I write a code and then this problem occurs:
path: /SASDataStudio/ui/asyncOperation
correlator: 71d9b09d-474a-451f-b71c-47941067a490
Thats my code:
data UpdatedData;
set CASUSER(luca.list@knime.com).ZS_HS_2019_STUENDLICH_WETTER;
/* Erstelle eine Testspalte */
TestColumn = "Test";
run;
Thanks
Please tell us what is wrong with your code. Please be specific and detailed.
I have imported data into SAS Viya, where the 'Zeit' column, which contains various timestamps from the year 2020, was not recognized as a datetime format but was instead interpreted as varchar. I attempted to manually convert this column to a datetime format. However, instead of displaying the converted datetime values, the new column only shows dots (.), indicating a failure in the conversion process.
If this is a common format for you, it could be an idea to create your own informat using PICTURE.
I couldn't find a SAS informat that can directly convert the source string to a SAS datetime value which is eventually also why your import didn't do it.
I did manage to convert the string to a SAS datetime value with code running in CAS using below syntax
cas mysession;
libname casuser cas;
data casuser.have;
length zs_hs_2019_andSoOn varchar(*);
zs_hs_2019_andSoOn='01.01.2019 05:43';
run;
/* data casuser.want; */
data casuser.have;
set casuser.have;
sas_dttm=sum(
input(scan(zs_hs_2019_andSoOn,1,' '),ddmmyy10.)*86400,
input(scan(zs_hs_2019_andSoOn,2,' '),time.)
);
format sas_dttm datetime20.;
run;
cas mysession terminate;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.