Importing NetCDF (.nc) files into a SAS dataset

Reply
Occasional Contributor
Posts: 13

Importing NetCDF (.nc) files into a SAS dataset

I haven't had much luck searching on this topic, so maybe someone else has run in to this. I'm trying to get a climate dataset of temperatures over time for a grid of locations (found here: Daily Gridded Surface Data | DAYMET) into SAS so it's a little more friendly to work with for data analysis and exporting summarized data to csv. However I haven't been able to find any way to do this yet. Most of the procedures written to convert NetCDF files to formats like ASCII were written for Linux and I get lost in trying to figure out code I'm not familiar with. Maybe there's some way to import directly to SAS and simplify things? It's been done for R, so that's one contingency I'm considering right now. Anyone here ever worked with NetCDF files?

Ultimately what I'm trying to do is have a dataset containing variables, latitude, longitude, time, and whatever variable (such as temperature) that is measured at each lat,long,time combination. NetCDF uses multidimensional arrays, so I assume if the file can be understood by SAS, it's just a matter of looping through the arrays to reduce the data to basically a flat 2D depiction of the data. That should let me use something simple like proc means with a by statement to find the minimum or maximum temperature for each location in the file.

PROC Star
Posts: 7,483

Re: Importing NetCDF (.nc) files into a SAS dataset

Posted in reply to hanson4022

The following page contains a link to a site from which you can download a free (I think) utility for converting NetCDF files to ASCII so they can be read into SAS: Statistical Summary "Lumping Up" Rules for Simulation Models

The download link, specifically, is NCO Homepage

Occasional Contributor
Posts: 13

Re: Importing NetCDF (.nc) files into a SAS dataset

Unfortunately, when I download the Windows package, it results in "unspecified errors" and doesn't install. It's looking like R might be the only option I've found that doesn't require figuring out the intricacies of other folk's codes.

Ask a Question
Discussion stats
  • 2 replies
  • 755 views
  • 0 likes
  • 2 in conversation