- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi! I'm working with the SAMHSA TEDS data set using CIMPORT. I used the recommended infile code:
proc cimport
infile= "C: \......\TEDS_2022.stc"lib=WORK;
Run;
But the variables are not populating in the table. I imported the coded variable library they provided but it's qualitative and I would rather work with the raw quanitative data that comes with the original imported file. You can get it through the .csv but it's so large I fear it may be incomplete. Is there a recommeded code I can use after the import to make sure the variables are recogized? I tried the libname= my lib and tranfile steps but they don't seem to work with .stc files. Any help is appreciated.
Thx
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are talking about this page
https://www.samhsa.gov/data/data-we-collect/teds/datafiles
(or perhaps some other year done in the same style) then I suspect that this issue is that you did not define the FORMATS that it has attached to the variables.
They included a .SAS file with the format definitions in the ZIP file.
Either set the system option NOFMTERR so that the Viewtable widget can open the dataset and SAS code can open the dataset.
options nofmterr ;
Or remove the formats from the variables. Either in an individual step.
proc print data=TEDSA_PUF_2022(obs=3) width=min;
format _all_ ;
run;
Or in a DATA step or PROC DATASETS step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure what you mean by
But the variables are not populating in the table.
Did the PROC CIMPORT step run or not?
How many datasets did it find in the .stc file?
What where their names?
What variables did they contain?
What do you mean by the word "table"? Do you mean a SAS dataset? Or did you run a program to produce a report? If the later what code did you try to run and what information where you trying to report on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It looks like the PROC CIMPORT STEP ran because it created a result viewtable in the work folder in the library. However when I try to open it, I get an error message saying it "cannot be opened". I then ran a PROC CONTENTS and it generated the list of variable names and values no problem. But won't populate the table in the results. If I import the library code, it populates the table in the viewtable, but it's coded to convert all the numeric data into qualitative data, I would rather it stay quant. It's just easier to program around and manipulate. This is data collected from a government survey with categorical and numeric variables. I haven't been able to find a lot out there on working with .sct files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are talking about this page
https://www.samhsa.gov/data/data-we-collect/teds/datafiles
(or perhaps some other year done in the same style) then I suspect that this issue is that you did not define the FORMATS that it has attached to the variables.
They included a .SAS file with the format definitions in the ZIP file.
Either set the system option NOFMTERR so that the Viewtable widget can open the dataset and SAS code can open the dataset.
options nofmterr ;
Or remove the formats from the variables. Either in an individual step.
proc print data=TEDSA_PUF_2022(obs=3) width=min;
format _all_ ;
run;
Or in a DATA step or PROC DATASETS step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
BRILLIANT! Thank you so much! I knew I was missing something obvious. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
option validvarname=any validmemname=extend nofmterr;
proc cimport
.......