Skip to content

Commit

Permalink
[XPT writer] Write row count in OBSV8 record
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmiller committed Jan 24, 2025
1 parent 0367470 commit 4cae7c9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/sas/readstat_xport_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ static readstat_error_t xport_write_header_record_v8(readstat_writer_t *writer,
xport_header_record_t *xrecord) {
char record[RECORD_LEN+1];
snprintf(record, sizeof(record),
"HEADER RECORD*******%-8sHEADER RECORD!!!!!!!%-30d",
xrecord->name, xrecord->num1);
"HEADER RECORD*******%-8sHEADER RECORD!!!!!!!" "%15d" "%15d",
xrecord->name, xrecord->num1, xrecord->num2);
return xport_write_record(writer, record);
}

Expand Down Expand Up @@ -356,12 +356,16 @@ static readstat_error_t xport_write_namestr_header_record(readstat_writer_t *wri
}

static readstat_error_t xport_write_obs_header_record(readstat_writer_t *writer) {
if (writer->version == 8) {
xport_header_record_t xrecord = {
.name = "OBSV8",
.num1 = writer->row_count
};
return xport_write_header_record_v8(writer, &xrecord);
}
xport_header_record_t xrecord = {
.name = "OBS"
};
if (writer->version == 8) {
strcpy(xrecord.name, "OBSV8");
}
return xport_write_header_record(writer, &xrecord);
}

Expand Down

0 comments on commit 4cae7c9

Please sign in to comment.