BookmarkSubscribeRSS Feed
Paolo311
Calcite | Level 5

I'm trying to import a local csv file using the SAS Data Explorer Visual Interface. The file is a two columns text file and both columns contain numerica values that should be interpreted as text.

All values are included between quotation marks (""), so I expect that the are typed as VARCHAR, but this is not the case.

I've tried to create an additional import options to force the type to be VARCHAR, but it didn't work. The import option I've used to force the two fields ("Codice IDBRE" and "Codice SASCN") to be typed as VARCHAR is the following:

Option name: variables

Option Value: [ {"name":"Codice IDBRE","type":"VARCHAR"}, {"name":"Codice SASCN","type":"VARCHAR"}, {"name":"Descrizione Impianto","type":"VARCHAR"} ]

 

I've attached a sample of the File I'm trying to import

2 REPLIES 2
Tom
Super User Tom
Super User

Shouldn't you read the CSV file into a SAS dataset before trying to pass it to SAS VA?  

 

Did you mistakenly try to use some guessing tool to read the CSV file, like PROC IMPORT?

It is trivial to just READ the file instead of trying to IMPORT it.

For example if the CSV has two variables of length 20 or less and a header line the data step to read it would look like this:

data want;
  infile "myfile.csv" dsd firstobs=2 truncover;
  input var1 :$20. var2 :$20.;
run;
Paolo311
Calcite | Level 5

Tom, thank you for your answer. Unfortunately my account has not access to the SAS programming interface, hence the only possibility I have to import a local file is the "Import" command of Visual Analytics GUI

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 2 replies
  • 667 views
  • 0 likes
  • 2 in conversation