A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/WizardMac/ReadStat/issues/233 below:

Trailing numerals in SAS Date/Time/DateTime formats are lost upon read · Issue #233 · WizardMac/ReadStat · GitHub

Note: I'm using the haven package in R to read in the data. I tried to trace the formatting as far down into C as my limited C knowledge allows, but it's very possible the information loss is happening on the R side.

SAS datetimes with a numeric qualifier (eg TIME5.) are read in without the trailing numeral (TIME). Would it be possible to include the numeric part of the format string?

Steps to Reproduce
  1. Create a SAS dataset with date, time or datetime variables with a specified format length. (SAS script and resulting dataset attached (sas_datetime_example_and_data.zip) with columns for each of SAS's datetime formats using both character and numeric internal representations.)
  2. Read in data in R
    df <- haven::read_sas("datetimes.sas")
    
    # extract readstat format from SAS column created using
    # FMT_TIME5=input(20999, TIME5.); format FMT_TIME5: TIME5.;
    attr(df[["FMT_TIME5"]], "format")  
    # TIME   # expected "TIME5"
Full set of formats which omit the numeric component SAS Format (9.04) R haven Format DATE9 DATE DDMMYY10 DDMMYY DDMMYYB10 DDMMYYB DDMMYYC10 DDMMYYC DDMMYYD10 DDMMYYD DDMMYYN6 DDMMYYN DDMMYYN8 DDMMYYN DDMMYYP10 DDMMYYP DDMMYYS10 DDMMYYS MMDDYY10 MMDDYY MMDDYYB10 MMDDYYB MMDDYYC10 MMDDYYC MMDDYYD10 MMDDYYD MMDDYYN6 MMDDYYN MMDDYYN8 MMDDYYN MMDDYYP10 MMDDYYP MMDDYYS10 MMDDYYS TIME5 TIME YYQRN7 YYQRN

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4