BookmarkSubscribeRSS Feed
egwilliamson
Obsidian | Level 7

When importing a .csv file to SAS VA I notice that some files are cutting the category vales short. For example, "Ireland" is showing up as "Irel", but in very few of the files it is showing up in full length. Any suggestions on how to make sure it loads with full length every time?

3 REPLIES 3
ballardw
Super User

I suspect that this is related to how you are importing the data into SAS. If you are using Proc Import then the program guesses for each file what the characteristics should be. The program by default uses something like the first 20 rows to set the lengths of variables. If you are using proc import then as a minimum add the GUESSINGROWS option with a large value (it can be larger than the number of records in your data) something in the range of 20000 might work.

Better if you are reading multiple files with the same format is to create a Datastep program so you can have fixed characteristics for all of your variables. The good thing is that proc import generates a datastep and the log from your proc import step should have the base code. You can copy from the long and save as a program and just change the input file and output dataset. Set the length of you character variables (Informat will do) to the longest expected (I ususally add a few more characters to allow for "new" data values).

egwilliamson
Obsidian | Level 7

I am loading the data through the SAS VA web interface - what would be the solution for using this method of importing the data?

ballardw
Super User

I don't have VA so can't suggest any options but If the first line in the file has the longest values then that might work.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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