BookmarkSubscribeRSS Feed
annie_1
Fluorite | Level 6

Hi, 

 

I need to import some dat files into SAS however each file is in a folder and all of these folders are within one folder.

At first I was just importing them one by one using libname and infile. However, I have 60 files I need.

Is there any way to extract the dat files without having to import them one by one? I know there are other posts that recommend doing a macro but I have very little experience with SAS and do not know how to do a macro. I am using SAS 9.4 (32).

Below is what i was doing

 

libname ds 'D:\Picarro Data\picarro data\2\2019';

x 'cd D:\Picarro Data\picarro data\2\2019';

 

* IMPORT P 2 DATA;

data df2_08272019;

infile '08\27\LBDS2023-20190827-111601Z-DataLog_User.dat' firstobs=2;

input DATE :$10. TIME :$15. FRAC_DAYS_SINCE_JAN1 $ FRAC_HRS_SINCE_JAN1 $ JULIAN_DAYS $ EPOCH_TIME $ ALARM_STATUS $ INST_STATUS $  CavityPressure $ CavityTemp WarmBoxTemp species H2CO H2CO_30s H2CO_2min H2CO_5min H2O CH4;

run;

 

data df2_082819;

infile '08\28\LBDS2023-20190828-101608Z-DataLog_User.dat' firstobs=2;

input DATE :$10. TIME :$15. FRAC_DAYS_SINCE_JAN1 $ FRAC_HRS_SINCE_JAN1 $ JULIAN_DAYS $ EPOCH_TIME $ ALARM_STATUS $ INST_STATUS $  CavityPressure $ CavityTemp WarmBoxTemp species H2CO H2CO_30s H2CO_2min H2CO_5min H2O CH4;

run;

 

Any help would be great.

Thank you.

1 REPLY 1

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1277 views
  • 0 likes
  • 2 in conversation