BookmarkSubscribeRSS Feed
Carlo98
Calcite | Level 5

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

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Please tell us what is wrong with your code. Please be specific and detailed.

--
Paige Miller
Carlo98
Calcite | Level 5

Carlo98_0-1714139801381.png

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.

LinusH
Tourmaline | Level 20

If this is a common format for you, it could be an idea to create your own informat using PICTURE.

Data never sleeps
Patrick
Opal | Level 21

@LinusH wrote:

If this is a common format for you, it could be an idea to create your own informat using PICTURE.


@LinusH How would you use a picture format to convert a source string to a SAS datetime value?

LinusH
Tourmaline | Level 20
My bad, and I think I made this mistake before...so I'm thinking that there should an INPICTURE capability in PROC FORMAT, corresponding to INVALUE.
Data never sleeps
Patrick
Opal | Level 21

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;
FreelanceReinh
Jade | Level 19

@Patrick wrote:

I couldn't find a SAS informat that can directly convert the source string to a SAS datetime value ...


Informat NLDATM. works for me with system option LOCALE=DE_DE.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 7 replies
  • 444 views
  • 3 likes
  • 5 in conversation