Linked Questions

Popular Questions

I'm attempting to iterate over some SAS files and convert them to a csv. I keep getting a "FileNotFoundError: [Errno 2] No such file or directory: 'table_name.sas7bdat' " error.

import os 
import pandas as pd

files = r"\\path\to\sas\tables"

for file in os.listdir(files):
    if file.endswith(".sas7bdat"):
        sasfile = pd.read_sas(file)
        df = pd.DataFrame(sasfile)
        filepath = r"\\path\to\csv\tables\{}.csv".format(sasfile)

The file does exist, so I don't know what to do with this error.

I've used both my mapped letter drives and my UNC paths. I've also just run the pd.read_sas() with the individual file and that works fine.

Related Questions